swig-Upgrade-to-support-newer-NodeJS.patch 75 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864
  1. From 5e1bdcfd6e5bd8353993433bd0efb4a3cb3ca639 Mon Sep 17 00:00:00 2001
  2. From: Alexandre Lissy <lissyx@lissyx.dyndns.org>
  3. Date: Thu, 25 Apr 2019 12:29:19 +0200
  4. Subject: [PATCH] Upgrade SWIG to support NodeJS v12, v13 / V8 v7.6, v7.8
  5. runtime
  6. ---
  7. .travis.yml | 35 ++++++++
  8. Examples/test-suite/javascript/Makefile.in | 15 +++-
  9. .../javascript/abstract_access_runme.js | 4 +-
  10. .../javascript/abstract_inherit_runme.js | 4 +-
  11. .../javascript/abstract_typedef2_runme.js | 4 +-
  12. .../javascript/abstract_typedef_runme.js | 4 +-
  13. .../javascript/abstract_virtual_runme.js | 4 +-
  14. .../javascript/array_member_runme.js | 4 +-
  15. .../javascript/arrays_global_runme.js | 4 +-
  16. .../test-suite/javascript/callback_runme.js | 4 +-
  17. .../javascript/char_binary_runme.js | 4 +-
  18. .../javascript/char_strings_runme.js | 4 +-
  19. .../javascript/class_ignore_runme.js | 4 +-
  20. .../javascript/class_scope_weird_runme.js | 4 +-
  21. .../javascript/complextest_runme.js | 4 +-
  22. .../test-suite/javascript/constover_runme.js | 4 +-
  23. .../javascript/constructor_copy_runme.js | 4 +-
  24. ...cpp11_strongly_typed_enumerations_runme.js | 4 +-
  25. .../test-suite/javascript/cpp_enum_runme.js | 4 +-
  26. .../javascript/cpp_namespace_runme.js | 4 +-
  27. .../test-suite/javascript/cpp_static_runme.js | 4 +-
  28. .../javascript/director_alternating_runme.js | 4 +-
  29. .../test-suite/javascript/disown_runme.js | 4 +-
  30. .../javascript/dynamic_cast_runme.js | 4 +-
  31. .../test-suite/javascript/empty_c_runme.js | 4 +-
  32. Examples/test-suite/javascript/empty_runme.js | 3 +-
  33. .../javascript/enum_template_runme.js | 4 +-
  34. .../test-suite/javascript/infinity_runme.js | 4 +-
  35. .../namespace_virtual_method_runme.js | 4 +-
  36. .../javascript/native_directive_runme.js | 4 +-
  37. .../javascript/nspace_extend_runme.js | 4 +-
  38. .../test-suite/javascript/nspace_runme.js | 4 +-
  39. .../javascript/null_pointer_runme.js | 4 +-
  40. .../javascript/overload_copy_runme.js | 4 +-
  41. .../javascript/overload_null_runme.js | 4 +-
  42. .../javascript/preproc_include_runme.js | 4 +-
  43. .../test-suite/javascript/preproc_runme.js | 4 +-
  44. .../test-suite/javascript/rename1_runme.js | 4 +-
  45. .../test-suite/javascript/rename2_runme.js | 4 +-
  46. .../test-suite/javascript/rename3_runme.js | 4 +-
  47. .../test-suite/javascript/rename4_runme.js | 4 +-
  48. .../javascript/rename_scope_runme.js | 4 +-
  49. .../javascript/rename_simple_runme.js | 4 +-
  50. .../javascript/ret_by_value_runme.js | 4 +-
  51. .../javascript/string_simple_runme.js | 4 +-
  52. .../javascript/struct_value_runme.js | 4 +-
  53. .../javascript/swig_exception_runme.js | 4 +-
  54. .../javascript/template_static_runme.js | 4 +-
  55. .../javascript/typedef_class_runme.js | 4 +-
  56. .../javascript/typedef_inherit_runme.js | 4 +-
  57. .../javascript/typedef_scope_runme.js | 4 +-
  58. .../javascript/typemap_arrays_runme.js | 4 +-
  59. .../javascript/typemap_delete_runme.js | 4 +-
  60. .../javascript/typemap_namespace_runme.js | 4 +-
  61. .../javascript/typemap_ns_using_runme.js | 4 +-
  62. .../test-suite/javascript/using1_runme.js | 4 +-
  63. .../test-suite/javascript/using2_runme.js | 4 +-
  64. .../test-suite/javascript/varargs_runme.js | 4 +-
  65. Lib/javascript/v8/javascriptcode.swg | 30 ++++---
  66. Lib/javascript/v8/javascriptcomplex.swg | 10 +--
  67. Lib/javascript/v8/javascripthelpers.swg | 26 +++---
  68. Lib/javascript/v8/javascriptinit.swg | 4 +-
  69. Lib/javascript/v8/javascriptprimtypes.swg | 28 +++----
  70. Lib/javascript/v8/javascriptrun.swg | 80 +++++++++++++------
  71. Lib/javascript/v8/javascriptruntime.swg | 5 ++
  72. Lib/javascript/v8/javascriptstrings.swg | 10 +--
  73. Lib/javascript/v8/javascripttypemaps.swg | 2 +-
  74. Source/Modules/javascript.cxx | 4 +-
  75. Tools/javascript/v8_shell.cxx | 18 ++---
  76. Tools/testflags.py | 5 +-
  77. Tools/travis-linux-install.sh | 7 +-
  78. 71 files changed, 358 insertions(+), 144 deletions(-)
  79. diff --git a/.travis.yml b/.travis.yml
  80. index 32c6656dd2..a53da19f68 100644
  81. --- a/.travis.yml
  82. +++ b/.travis.yml
  83. @@ -112,6 +112,41 @@ matrix:
  84. env: SWIGLANG=javascript ENGINE=node VER=10 CPP11=1
  85. sudo: required
  86. dist: xenial
  87. + - compiler: gcc
  88. + os: linux
  89. + env: SWIGLANG=javascript ENGINE=node VER=12.8.1 CPP11=1
  90. + sudo: required
  91. + dist: xenial
  92. + - compiler: gcc
  93. + os: linux
  94. + env: SWIGLANG=javascript ENGINE=node VER=12.10.0 CPP11=1
  95. + sudo: required
  96. + dist: xenial
  97. + - compiler: gcc
  98. + os: linux
  99. + env: SWIGLANG=javascript ENGINE=node VER=12.14.1 CPP11=1
  100. + sudo: required
  101. + dist: xenial
  102. + - compiler: gcc
  103. + os: linux
  104. + env: SWIGLANG=javascript ENGINE=node VER=13.1.0 CPP11=1
  105. + sudo: required
  106. + dist: xenial
  107. + - compiler: gcc
  108. + os: linux
  109. + env: SWIGLANG=javascript ENGINE=node VER=13.6.0 CPP11=1
  110. + sudo: required
  111. + dist: xenial
  112. + - compiler: gcc
  113. + os: linux
  114. + env: SWIGLANG=javascript ENGINE=electron VER=12.14.1 ELECTRON_VER=7.0.1 CPP11=1
  115. + sudo: required
  116. + dist: xenial
  117. + - compiler: gcc
  118. + os: linux
  119. + env: SWIGLANG=javascript ENGINE=electron VER=12.14.1 ELECTRON_VER=7.1.8 CPP11=1
  120. + sudo: required
  121. + dist: xenial
  122. - compiler: gcc
  123. os: linux
  124. env: SWIGLANG=javascript ENGINE=jsc
  125. diff --git a/Examples/test-suite/javascript/Makefile.in b/Examples/test-suite/javascript/Makefile.in
  126. index 8127415f12..b780a9e9cf 100644
  127. --- a/Examples/test-suite/javascript/Makefile.in
  128. +++ b/Examples/test-suite/javascript/Makefile.in
  129. @@ -16,6 +16,17 @@ top_builddir = @top_builddir@
  130. SWIGEXE = $(top_builddir)/swig
  131. SWIG_LIB_DIR = $(top_srcdir)/Lib
  132. +ifeq (electron, $(ENGINE))
  133. +NODE_DISTURL = --disturl=https://electronjs.org/headers
  134. +NODE_RUNTIME = --runtime=electron
  135. +NODE_ABI_TARGET = --target=${ELECTRON_VER}
  136. +ENGINE =
  137. +NODEJS = electron
  138. +else
  139. +NODE_DISTURL =
  140. +NODE_RUNTIME =
  141. +endif
  142. +
  143. ifneq (, $(ENGINE))
  144. JSENGINE=$(ENGINE)
  145. else
  146. @@ -66,14 +77,14 @@ ifeq (node,$(JSENGINE))
  147. $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' \
  148. SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
  149. SWIGOPT='-javascript $(SWIGOPT) -o $*_wrap.cxx $(srcdir)/../$*.i' swiginvoke && \
  150. - MAKEFLAGS= $(COMPILETOOL) $(NODEGYP) --loglevel=silent --directory $* configure build 1>>/dev/null
  151. + MAKEFLAGS= $(COMPILETOOL) $(NODEGYP) $(NODE_ABI_TARGET) $(NODE_DISTURL) $(NODE_RUNTIME) --loglevel=silent --directory $* configure build 1>>/dev/null
  152. swig_and_compile_cpp = \
  153. $(setup_node) && \
  154. $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' \
  155. SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \
  156. SWIGOPT='-c++ -javascript $(SWIGOPT) $(srcdir)/../$*.i' swiginvoke && \
  157. - MAKEFLAGS= $(COMPILETOOL) $(NODEGYP) --loglevel=silent --directory $* configure build 1>>/dev/null
  158. + MAKEFLAGS= $(COMPILETOOL) $(NODEGYP) $(NODE_ABI_TARGET) $(NODE_DISTURL) $(NODE_RUNTIME) --loglevel=silent --directory $* configure build 1>>/dev/null
  159. run_testcase = \
  160. if [ -f $(srcdir)/$*$(SCRIPTSUFFIX) ]; then \
  161. diff --git a/Examples/test-suite/javascript/abstract_access_runme.js b/Examples/test-suite/javascript/abstract_access_runme.js
  162. index f61bb4358b..b2b5e95fb4 100644
  163. --- a/Examples/test-suite/javascript/abstract_access_runme.js
  164. +++ b/Examples/test-suite/javascript/abstract_access_runme.js
  165. @@ -1,6 +1,8 @@
  166. -var abstract_access = require("abstract_access");
  167. +var abstract_access = require("./abstract_access");
  168. var d = new abstract_access.D()
  169. if (d.do_x() != 1) {
  170. throw "Error";
  171. }
  172. +
  173. +process.exit(0);
  174. diff --git a/Examples/test-suite/javascript/abstract_inherit_runme.js b/Examples/test-suite/javascript/abstract_inherit_runme.js
  175. index f732e87673..6f58400373 100644
  176. --- a/Examples/test-suite/javascript/abstract_inherit_runme.js
  177. +++ b/Examples/test-suite/javascript/abstract_inherit_runme.js
  178. @@ -1,4 +1,4 @@
  179. -var abstract_inherit = require("abstract_inherit");
  180. +var abstract_inherit = require("./abstract_inherit");
  181. // Shouldn't be able to instantiate any of these classes
  182. // since none of them implements the pure virtual function
  183. @@ -38,3 +38,5 @@ try {
  184. if (!caughtException) {
  185. throw new Error("Spam should be instantiated as it is abstract");
  186. }
  187. +
  188. +process.exit(0);
  189. diff --git a/Examples/test-suite/javascript/abstract_typedef2_runme.js b/Examples/test-suite/javascript/abstract_typedef2_runme.js
  190. index d8a533ab1d..f1c293818d 100644
  191. --- a/Examples/test-suite/javascript/abstract_typedef2_runme.js
  192. +++ b/Examples/test-suite/javascript/abstract_typedef2_runme.js
  193. @@ -1,6 +1,8 @@
  194. -var abstract_typedef2 = require("abstract_typedef2");
  195. +var abstract_typedef2 = require("./abstract_typedef2");
  196. var a = new abstract_typedef2.A_UF();
  197. if (a == undefined)
  198. throw "Error";
  199. +
  200. +process.exit(0);
  201. diff --git a/Examples/test-suite/javascript/abstract_typedef_runme.js b/Examples/test-suite/javascript/abstract_typedef_runme.js
  202. index 286328fa8c..09b271218c 100644
  203. --- a/Examples/test-suite/javascript/abstract_typedef_runme.js
  204. +++ b/Examples/test-suite/javascript/abstract_typedef_runme.js
  205. @@ -1,4 +1,4 @@
  206. -var abstract_typedef = require("abstract_typedef");
  207. +var abstract_typedef = require("./abstract_typedef");
  208. var e = new abstract_typedef.Engine();
  209. var a = new abstract_typedef.A()
  210. @@ -6,3 +6,5 @@ var a = new abstract_typedef.A()
  211. if (a.write(e) != 1) {
  212. throw "Error";
  213. }
  214. +
  215. +process.exit(0);
  216. diff --git a/Examples/test-suite/javascript/abstract_virtual_runme.js b/Examples/test-suite/javascript/abstract_virtual_runme.js
  217. index 9a9ce99885..f0d505d922 100644
  218. --- a/Examples/test-suite/javascript/abstract_virtual_runme.js
  219. +++ b/Examples/test-suite/javascript/abstract_virtual_runme.js
  220. @@ -1,4 +1,4 @@
  221. -var abstract_virtual = require("abstract_virtual");
  222. +var abstract_virtual = require("./abstract_virtual");
  223. d = new abstract_virtual.D()
  224. @@ -9,3 +9,5 @@ e = new abstract_virtual.E()
  225. if (e == undefined)
  226. throw "Error";
  227. +
  228. +process.exit(0);
  229. diff --git a/Examples/test-suite/javascript/array_member_runme.js b/Examples/test-suite/javascript/array_member_runme.js
  230. index 3d9bb0e5b3..64d158df59 100644
  231. --- a/Examples/test-suite/javascript/array_member_runme.js
  232. +++ b/Examples/test-suite/javascript/array_member_runme.js
  233. @@ -1,4 +1,4 @@
  234. -var array_member = require("array_member");
  235. +var array_member = require("./array_member");
  236. var f = new array_member.Foo();
  237. f.data = array_member.global_data;
  238. @@ -20,3 +20,5 @@ for (var i=0; i<8; i++){
  239. throw "Bad array assignment (2)";
  240. }
  241. }
  242. +
  243. +process.exit(0);
  244. diff --git a/Examples/test-suite/javascript/arrays_global_runme.js b/Examples/test-suite/javascript/arrays_global_runme.js
  245. index 0cbb28efba..db4ac20526 100644
  246. --- a/Examples/test-suite/javascript/arrays_global_runme.js
  247. +++ b/Examples/test-suite/javascript/arrays_global_runme.js
  248. @@ -1,4 +1,4 @@
  249. -var arrays_global = require("arrays_global");
  250. +var arrays_global = require("./arrays_global");
  251. arrays_global.array_i = arrays_global.array_const_i;
  252. @@ -16,3 +16,5 @@ arrays_global.BeginString_FIX44f;
  253. arrays_global.test_a("hello","hi","chello","chi");
  254. arrays_global.test_b("1234567","hi");
  255. +
  256. +process.exit(0);
  257. diff --git a/Examples/test-suite/javascript/callback_runme.js b/Examples/test-suite/javascript/callback_runme.js
  258. index 0218886419..aa22cd21fd 100644
  259. --- a/Examples/test-suite/javascript/callback_runme.js
  260. +++ b/Examples/test-suite/javascript/callback_runme.js
  261. @@ -1,4 +1,4 @@
  262. -var callback = require("callback");
  263. +var callback = require("./callback");
  264. if (callback.foo(2) !== 2) {
  265. throw new Error("Failed.");
  266. @@ -28,3 +28,5 @@ var a = new callback.A();
  267. if (callback.foobarm(3, a, callback.A.foom_cb_ptr) != a.foom(3)) {
  268. throw new Error("Failed.");
  269. }
  270. +
  271. +process.exit(0);
  272. diff --git a/Examples/test-suite/javascript/char_binary_runme.js b/Examples/test-suite/javascript/char_binary_runme.js
  273. index 01b72ebe14..8b7e400349 100644
  274. --- a/Examples/test-suite/javascript/char_binary_runme.js
  275. +++ b/Examples/test-suite/javascript/char_binary_runme.js
  276. @@ -1,4 +1,4 @@
  277. -var char_binary = require("char_binary");
  278. +var char_binary = require("./char_binary");
  279. var t = new char_binary.Test();
  280. if (t.strlen('hile') != 4) {
  281. @@ -46,3 +46,5 @@ if (char_binary.var_namet != "hola") {
  282. throw("bad pointer case (2)");
  283. }
  284. char_binary.delete_pchar(pc);
  285. +
  286. +process.exit(0);
  287. diff --git a/Examples/test-suite/javascript/char_strings_runme.js b/Examples/test-suite/javascript/char_strings_runme.js
  288. index fe17cb9827..0cbe81e542 100644
  289. --- a/Examples/test-suite/javascript/char_strings_runme.js
  290. +++ b/Examples/test-suite/javascript/char_strings_runme.js
  291. @@ -1,4 +1,4 @@
  292. -var char_strings = require("char_strings");
  293. +var char_strings = require("./char_strings");
  294. var assertIsEqual = function(expected, actual) {
  295. if (expected !== actual) {
  296. @@ -9,3 +9,5 @@ var assertIsEqual = function(expected, actual) {
  297. assertIsEqual("hi there", char_strings.CharPingPong("hi there"));
  298. assertIsEqual("hi there", char_strings.CharArrayPingPong("hi there"));
  299. assertIsEqual("hi there", char_strings.CharArrayDimsPingPong("hi there"));
  300. +
  301. +process.exit(0);
  302. diff --git a/Examples/test-suite/javascript/class_ignore_runme.js b/Examples/test-suite/javascript/class_ignore_runme.js
  303. index ffbe021c71..938a19fc8d 100644
  304. --- a/Examples/test-suite/javascript/class_ignore_runme.js
  305. +++ b/Examples/test-suite/javascript/class_ignore_runme.js
  306. @@ -1,6 +1,8 @@
  307. -var class_ignore = require("class_ignore");
  308. +var class_ignore = require("./class_ignore");
  309. a = new class_ignore.Bar();
  310. if (class_ignore.do_blah(a) != "Bar::blah")
  311. throw "Error";
  312. +
  313. +process.exit(0);
  314. diff --git a/Examples/test-suite/javascript/class_scope_weird_runme.js b/Examples/test-suite/javascript/class_scope_weird_runme.js
  315. index 73c118d617..325fefbac5 100644
  316. --- a/Examples/test-suite/javascript/class_scope_weird_runme.js
  317. +++ b/Examples/test-suite/javascript/class_scope_weird_runme.js
  318. @@ -1,6 +1,8 @@
  319. -var class_scope_weird = require("class_scope_weird");
  320. +var class_scope_weird = require("./class_scope_weird");
  321. f = new class_scope_weird.Foo();
  322. g = new class_scope_weird.Foo(3);
  323. if (f.bar(3) != 3)
  324. throw RuntimeError;
  325. +
  326. +process.exit(0);
  327. diff --git a/Examples/test-suite/javascript/complextest_runme.js b/Examples/test-suite/javascript/complextest_runme.js
  328. index 1d9825f3b2..7e3e3e984b 100644
  329. --- a/Examples/test-suite/javascript/complextest_runme.js
  330. +++ b/Examples/test-suite/javascript/complextest_runme.js
  331. @@ -1,4 +1,4 @@
  332. -var complextest = require("complextest");
  333. +var complextest = require("./complextest");
  334. a = [-1,2];
  335. @@ -29,3 +29,5 @@ v.add(1);
  336. // TODO: how to check validity?
  337. complextest.CopyHalf(v);
  338. complextest.CopyHalfRef(v);
  339. +
  340. +process.exit(0);
  341. diff --git a/Examples/test-suite/javascript/constover_runme.js b/Examples/test-suite/javascript/constover_runme.js
  342. index 9b192b5ff7..bae3344072 100644
  343. --- a/Examples/test-suite/javascript/constover_runme.js
  344. +++ b/Examples/test-suite/javascript/constover_runme.js
  345. @@ -1,4 +1,4 @@
  346. -var constover = require("constover");
  347. +var constover = require("./constover");
  348. p = constover.test("test");
  349. if (p != "test") {
  350. @@ -31,3 +31,5 @@ p = f.test_pconstm("test");
  351. if (p != "test_pconstmethod") {
  352. throw "member-test_pconstm failed!";
  353. }
  354. +
  355. +process.exit(0);
  356. diff --git a/Examples/test-suite/javascript/constructor_copy_runme.js b/Examples/test-suite/javascript/constructor_copy_runme.js
  357. index 179b9fb406..0d811470f1 100644
  358. --- a/Examples/test-suite/javascript/constructor_copy_runme.js
  359. +++ b/Examples/test-suite/javascript/constructor_copy_runme.js
  360. @@ -1,4 +1,4 @@
  361. -var constructor_copy = require("constructor_copy");
  362. +var constructor_copy = require("./constructor_copy");
  363. f1 = new constructor_copy.Foo1(3);
  364. f11 = new constructor_copy.Foo1(f1);
  365. @@ -40,3 +40,5 @@ try {
  366. if (good == 0) {
  367. throw "Error: should not allow calling copy ctor for Bard";
  368. }
  369. +
  370. +process.exit(0);
  371. diff --git a/Examples/test-suite/javascript/cpp11_strongly_typed_enumerations_runme.js b/Examples/test-suite/javascript/cpp11_strongly_typed_enumerations_runme.js
  372. index ad9d4e8833..241e38b768 100644
  373. --- a/Examples/test-suite/javascript/cpp11_strongly_typed_enumerations_runme.js
  374. +++ b/Examples/test-suite/javascript/cpp11_strongly_typed_enumerations_runme.js
  375. @@ -1,4 +1,4 @@
  376. -var cpp11_strongly_typed_enumerations = require("cpp11_strongly_typed_enumerations");
  377. +var cpp11_strongly_typed_enumerations = require("./cpp11_strongly_typed_enumerations");
  378. function enumCheck(actual, expected) {
  379. if (actual != expected) {
  380. @@ -163,3 +163,5 @@ enumCheck(class1.class1Test2(cpp11_strongly_typed_enumerations.Class1.Enum12_Val
  381. enumCheck(cpp11_strongly_typed_enumerations.globalTest1(cpp11_strongly_typed_enumerations.Enum1_Val5a), 13);
  382. enumCheck(cpp11_strongly_typed_enumerations.globalTest2(cpp11_strongly_typed_enumerations.Class1.Enum12_Val5c), 1121);
  383. //enumCheck(globalTest3(cpp11_strongly_typed_enumerations.Class1.Struct1_Enum12_Val5f), 3121);
  384. +
  385. +process.exit(0);
  386. diff --git a/Examples/test-suite/javascript/cpp_enum_runme.js b/Examples/test-suite/javascript/cpp_enum_runme.js
  387. index 8a248c372a..990f703c39 100644
  388. --- a/Examples/test-suite/javascript/cpp_enum_runme.js
  389. +++ b/Examples/test-suite/javascript/cpp_enum_runme.js
  390. @@ -1,4 +1,4 @@
  391. -var cpp_enum = require("cpp_enum");
  392. +var cpp_enum = require("./cpp_enum");
  393. var f = new cpp_enum.Foo()
  394. @@ -26,3 +26,5 @@ if(cpp_enum.Foo.hi != cpp_enum.Hello){
  395. throw "Error";
  396. }
  397. +
  398. +process.exit(0);
  399. diff --git a/Examples/test-suite/javascript/cpp_namespace_runme.js b/Examples/test-suite/javascript/cpp_namespace_runme.js
  400. index a6ab799646..69e74ae4ed 100644
  401. --- a/Examples/test-suite/javascript/cpp_namespace_runme.js
  402. +++ b/Examples/test-suite/javascript/cpp_namespace_runme.js
  403. @@ -1,4 +1,4 @@
  404. -var cpp_namespace = require("cpp_namespace");
  405. +var cpp_namespace = require("./cpp_namespace");
  406. var n = cpp_namespace.fact(4);
  407. if (n != 24){
  408. @@ -45,3 +45,5 @@ if (cpp_namespace.do_method3(t4,40) != "Test4::method"){
  409. if (cpp_namespace.do_method3(t5,40) != "Test5::method"){
  410. throw ("Bad return value error!");
  411. }
  412. +
  413. +process.exit(0);
  414. diff --git a/Examples/test-suite/javascript/cpp_static_runme.js b/Examples/test-suite/javascript/cpp_static_runme.js
  415. index c7917e12ea..e78b7016bd 100644
  416. --- a/Examples/test-suite/javascript/cpp_static_runme.js
  417. +++ b/Examples/test-suite/javascript/cpp_static_runme.js
  418. @@ -1,4 +1,4 @@
  419. -var cpp_static = require("cpp_static");
  420. +var cpp_static = require("./cpp_static");
  421. cpp_static.StaticFunctionTest.static_func();
  422. cpp_static.StaticFunctionTest.static_func_2(1);
  423. @@ -7,3 +7,5 @@ cpp_static.StaticMemberTest.static_int = 10;
  424. if (cpp_static.StaticMemberTest.static_int != 10)
  425. throw "error";
  426. +
  427. +process.exit(0);
  428. diff --git a/Examples/test-suite/javascript/director_alternating_runme.js b/Examples/test-suite/javascript/director_alternating_runme.js
  429. index cff288d35c..40da25af0c 100644
  430. --- a/Examples/test-suite/javascript/director_alternating_runme.js
  431. +++ b/Examples/test-suite/javascript/director_alternating_runme.js
  432. @@ -1,5 +1,7 @@
  433. -var director_alternating = require("director_alternating");
  434. +var director_alternating = require("./director_alternating");
  435. id = director_alternating.getBar().id();
  436. if (id != director_alternating.idFromGetBar())
  437. throw ("Error, Got wrong id: " + str(id));
  438. +
  439. +process.exit(0);
  440. diff --git a/Examples/test-suite/javascript/disown_runme.js b/Examples/test-suite/javascript/disown_runme.js
  441. index ea742b51e5..1950a2fb6c 100644
  442. --- a/Examples/test-suite/javascript/disown_runme.js
  443. +++ b/Examples/test-suite/javascript/disown_runme.js
  444. @@ -1,4 +1,4 @@
  445. -var disown = require("disown");
  446. +var disown = require("./disown");
  447. var a = new disown.A();
  448. var tmp = a.thisown;
  449. @@ -20,3 +20,5 @@ b.acquire(a);
  450. if (a.thisown) {
  451. throw new Error("Failed.");
  452. }
  453. +
  454. +process.exit(0);
  455. diff --git a/Examples/test-suite/javascript/dynamic_cast_runme.js b/Examples/test-suite/javascript/dynamic_cast_runme.js
  456. index 32eabcf8b0..b807a93ca2 100644
  457. --- a/Examples/test-suite/javascript/dynamic_cast_runme.js
  458. +++ b/Examples/test-suite/javascript/dynamic_cast_runme.js
  459. @@ -1,4 +1,4 @@
  460. -var dynamic_cast = require("dynamic_cast");
  461. +var dynamic_cast = require("./dynamic_cast");
  462. var f = new dynamic_cast.Foo();
  463. var b = new dynamic_cast.Bar();
  464. @@ -10,3 +10,5 @@ var a = dynamic_cast.do_test(y);
  465. if (a != "Bar::test") {
  466. throw new Error("Failed.");
  467. }
  468. +
  469. +process.exit(0);
  470. diff --git a/Examples/test-suite/javascript/empty_c_runme.js b/Examples/test-suite/javascript/empty_c_runme.js
  471. index 1cc22e4ce7..61d57853bf 100644
  472. --- a/Examples/test-suite/javascript/empty_c_runme.js
  473. +++ b/Examples/test-suite/javascript/empty_c_runme.js
  474. @@ -1 +1,3 @@
  475. -var empty_c = require("empty_c");
  476. +var empty_c = require("./empty_c");
  477. +
  478. +process.exit(0);
  479. diff --git a/Examples/test-suite/javascript/empty_runme.js b/Examples/test-suite/javascript/empty_runme.js
  480. index 7894379bee..a16eed15a1 100644
  481. --- a/Examples/test-suite/javascript/empty_runme.js
  482. +++ b/Examples/test-suite/javascript/empty_runme.js
  483. @@ -1 +1,2 @@
  484. -var empty = require("empty");
  485. \ No newline at end of file
  486. +var empty = require("./empty");
  487. +process.exit(0);
  488. diff --git a/Examples/test-suite/javascript/enum_template_runme.js b/Examples/test-suite/javascript/enum_template_runme.js
  489. index 1e71e5f640..c44b813644 100644
  490. --- a/Examples/test-suite/javascript/enum_template_runme.js
  491. +++ b/Examples/test-suite/javascript/enum_template_runme.js
  492. @@ -1,4 +1,4 @@
  493. -var enum_template = require("enum_template");
  494. +var enum_template = require("./enum_template");
  495. if (enum_template.MakeETest() != 1)
  496. throw "RuntimeError";
  497. @@ -6,3 +6,5 @@ if (enum_template.MakeETest() != 1)
  498. if (enum_template.TakeETest(0) != null)
  499. throw "RuntimeError";
  500. +
  501. +process.exit(0);
  502. diff --git a/Examples/test-suite/javascript/infinity_runme.js b/Examples/test-suite/javascript/infinity_runme.js
  503. index 8ebe496a6b..4bef97a1c1 100644
  504. --- a/Examples/test-suite/javascript/infinity_runme.js
  505. +++ b/Examples/test-suite/javascript/infinity_runme.js
  506. @@ -1,5 +1,7 @@
  507. -var infinity = require("infinity");
  508. +var infinity = require("./infinity");
  509. infinity.initialise_MYINFINITY();
  510. var my_infinity = infinity.INFINITY;
  511. var ret_val = infinity.use_infinity(my_infinity);
  512. +
  513. +process.exit(0);
  514. diff --git a/Examples/test-suite/javascript/namespace_virtual_method_runme.js b/Examples/test-suite/javascript/namespace_virtual_method_runme.js
  515. index 4f1e05c848..9dfe33a3ea 100644
  516. --- a/Examples/test-suite/javascript/namespace_virtual_method_runme.js
  517. +++ b/Examples/test-suite/javascript/namespace_virtual_method_runme.js
  518. @@ -1,3 +1,5 @@
  519. -var namespace_virtual_method = require("namespace_virtual_method");
  520. +var namespace_virtual_method = require("./namespace_virtual_method");
  521. x = new namespace_virtual_method.Spam();
  522. +
  523. +process.exit(0);
  524. diff --git a/Examples/test-suite/javascript/native_directive_runme.js b/Examples/test-suite/javascript/native_directive_runme.js
  525. index 5c1d69cf17..c7573cf7d8 100644
  526. --- a/Examples/test-suite/javascript/native_directive_runme.js
  527. +++ b/Examples/test-suite/javascript/native_directive_runme.js
  528. @@ -1,4 +1,4 @@
  529. -var native_directive = require("native_directive");
  530. +var native_directive = require("./native_directive");
  531. (function main() {
  532. var s = "abc.DEF-123";
  533. @@ -7,3 +7,5 @@ var native_directive = require("native_directive");
  534. if (native_directive.CountAlphaCharacters(s) !== 6)
  535. throw "CountAlphaCharacters failed";
  536. })();
  537. +
  538. +process.exit(0);
  539. diff --git a/Examples/test-suite/javascript/nspace_extend_runme.js b/Examples/test-suite/javascript/nspace_extend_runme.js
  540. index 8cabfe9457..b7daf883a9 100644
  541. --- a/Examples/test-suite/javascript/nspace_extend_runme.js
  542. +++ b/Examples/test-suite/javascript/nspace_extend_runme.js
  543. @@ -1,4 +1,4 @@
  544. -var nspace_extend = require("nspace_extend");
  545. +var nspace_extend = require("./nspace_extend");
  546. // constructors and destructors
  547. var color1 = new nspace_extend.Outer.Inner1.Color();
  548. @@ -25,3 +25,5 @@ created = nspace_extend.Outer.Inner2.Color.create();
  549. var col1 = new nspace_extend.Outer.Inner1.Color();
  550. var col2 = nspace_extend.Outer.Inner2.Color.create();
  551. col2.colors(col1, col1, col2, col2, col2);
  552. +
  553. +process.exit(0);
  554. diff --git a/Examples/test-suite/javascript/nspace_runme.js b/Examples/test-suite/javascript/nspace_runme.js
  555. index 993610dd62..5402b13af9 100644
  556. --- a/Examples/test-suite/javascript/nspace_runme.js
  557. +++ b/Examples/test-suite/javascript/nspace_runme.js
  558. @@ -1,4 +1,4 @@
  559. -var nspace = require("nspace");
  560. +var nspace = require("./nspace");
  561. var color1 = new nspace.Outer.Inner1.Color();
  562. var color = new nspace.Outer.Inner1.Color(color1);
  563. @@ -74,3 +74,5 @@ var blue3 = new nspace.Outer.Inner3.Blue();
  564. blue3.blueInstanceMethod();
  565. var blue4 = new nspace.Outer.Inner4.Blue();
  566. blue4.blueInstanceMethod();
  567. +
  568. +process.exit(0);
  569. diff --git a/Examples/test-suite/javascript/null_pointer_runme.js b/Examples/test-suite/javascript/null_pointer_runme.js
  570. index 8a9b611867..25d1e535f4 100644
  571. --- a/Examples/test-suite/javascript/null_pointer_runme.js
  572. +++ b/Examples/test-suite/javascript/null_pointer_runme.js
  573. @@ -1,4 +1,4 @@
  574. -var null_pointer = require("null_pointer");
  575. +var null_pointer = require("./null_pointer");
  576. if (!null_pointer.funk(null)) {
  577. throw new Error("Javascript 'null' should be converted into NULL.");
  578. @@ -7,3 +7,5 @@ if (!null_pointer.funk(null)) {
  579. if (null_pointer.getnull() != null) {
  580. throw new Error("NULL should be converted into Javascript 'null'.");
  581. }
  582. +
  583. +process.exit(0);
  584. diff --git a/Examples/test-suite/javascript/overload_copy_runme.js b/Examples/test-suite/javascript/overload_copy_runme.js
  585. index e2f6107884..a1e1459317 100644
  586. --- a/Examples/test-suite/javascript/overload_copy_runme.js
  587. +++ b/Examples/test-suite/javascript/overload_copy_runme.js
  588. @@ -1,4 +1,6 @@
  589. -var overload_copy = require("overload_copy");
  590. +var overload_copy = require("./overload_copy");
  591. f = new overload_copy.Foo();
  592. g = new overload_copy.Foo(f);
  593. +
  594. +process.exit(0);
  595. diff --git a/Examples/test-suite/javascript/overload_null_runme.js b/Examples/test-suite/javascript/overload_null_runme.js
  596. index f1e35cac76..74d855248e 100644
  597. --- a/Examples/test-suite/javascript/overload_null_runme.js
  598. +++ b/Examples/test-suite/javascript/overload_null_runme.js
  599. @@ -1,6 +1,6 @@
  600. // There are no typecheck typemaps in Javascript yet, so most of this test
  601. // does not actually worked - the check functions have thus been commented out.
  602. -var overload_null = require("overload_null");
  603. +var overload_null = require("./overload_null");
  604. var check = function(expected, actual) {
  605. if (expected !== actual) {
  606. @@ -47,3 +47,5 @@ check(20, o.byval2forwardptr(x));
  607. check(21, o.byval1forwardref(x));
  608. check(22, o.byval2forwardref(x));
  609. +
  610. +process.exit(0);
  611. diff --git a/Examples/test-suite/javascript/preproc_include_runme.js b/Examples/test-suite/javascript/preproc_include_runme.js
  612. index 5ec72b842d..8d4e8601f6 100644
  613. --- a/Examples/test-suite/javascript/preproc_include_runme.js
  614. +++ b/Examples/test-suite/javascript/preproc_include_runme.js
  615. @@ -1,4 +1,4 @@
  616. -var preproc_include = require("preproc_include");
  617. +var preproc_include = require("./preproc_include");
  618. if (preproc_include.multiply10(10) != 100)
  619. throw "RuntimeError";
  620. @@ -21,3 +21,5 @@ if (preproc_include.multiply60(10) != 600)
  621. if (preproc_include.multiply70(10) != 700)
  622. throw "RuntimeError";
  623. +
  624. +process.exit(0);
  625. diff --git a/Examples/test-suite/javascript/preproc_runme.js b/Examples/test-suite/javascript/preproc_runme.js
  626. index 167ca5ac1c..15e026d8a6 100644
  627. --- a/Examples/test-suite/javascript/preproc_runme.js
  628. +++ b/Examples/test-suite/javascript/preproc_runme.js
  629. @@ -1,4 +1,4 @@
  630. -var preproc = require("preproc");
  631. +var preproc = require("./preproc");
  632. if (preproc.endif != 1)
  633. throw "RuntimeError";
  634. @@ -12,3 +12,5 @@ if (preproc.defined != 1)
  635. if (2*preproc.one != preproc.two)
  636. throw "RuntimeError";
  637. +
  638. +process.exit(0);
  639. diff --git a/Examples/test-suite/javascript/rename1_runme.js b/Examples/test-suite/javascript/rename1_runme.js
  640. index 7b2ac37b6d..4741673c90 100644
  641. --- a/Examples/test-suite/javascript/rename1_runme.js
  642. +++ b/Examples/test-suite/javascript/rename1_runme.js
  643. @@ -1,4 +1,4 @@
  644. -var rename = require("rename1");
  645. +var rename = require("./rename1");
  646. function part1() {
  647. var xyz = new rename.XYZInt();
  648. @@ -62,3 +62,5 @@ part2();
  649. part3();
  650. part4();
  651. part5();
  652. +
  653. +process.exit(0);
  654. diff --git a/Examples/test-suite/javascript/rename2_runme.js b/Examples/test-suite/javascript/rename2_runme.js
  655. index 040c798bb5..6f6a7d3814 100644
  656. --- a/Examples/test-suite/javascript/rename2_runme.js
  657. +++ b/Examples/test-suite/javascript/rename2_runme.js
  658. @@ -1,4 +1,4 @@
  659. -var rename = require("rename2");
  660. +var rename = require("./rename2");
  661. function part1() {
  662. var xyz = new rename.XYZInt();
  663. @@ -62,3 +62,5 @@ part2();
  664. part3();
  665. part4();
  666. part5();
  667. +
  668. +process.exit(0);
  669. diff --git a/Examples/test-suite/javascript/rename3_runme.js b/Examples/test-suite/javascript/rename3_runme.js
  670. index fb9393b037..fcac4dfe02 100644
  671. --- a/Examples/test-suite/javascript/rename3_runme.js
  672. +++ b/Examples/test-suite/javascript/rename3_runme.js
  673. @@ -1,4 +1,4 @@
  674. -var rename = require("rename3");
  675. +var rename = require("./rename3");
  676. function part1() {
  677. var xyz = new rename.XYZInt();
  678. @@ -62,3 +62,5 @@ part2();
  679. part3();
  680. part4();
  681. part5();
  682. +
  683. +process.exit(0);
  684. diff --git a/Examples/test-suite/javascript/rename4_runme.js b/Examples/test-suite/javascript/rename4_runme.js
  685. index 1c3d8e77f5..9bf1c45a24 100644
  686. --- a/Examples/test-suite/javascript/rename4_runme.js
  687. +++ b/Examples/test-suite/javascript/rename4_runme.js
  688. @@ -1,4 +1,4 @@
  689. -var rename = require("rename4");
  690. +var rename = require("./rename4");
  691. function part1() {
  692. var xyz = new rename.XYZInt();
  693. @@ -62,3 +62,5 @@ part2();
  694. part3();
  695. part4();
  696. part5();
  697. +
  698. +process.exit(0);
  699. diff --git a/Examples/test-suite/javascript/rename_scope_runme.js b/Examples/test-suite/javascript/rename_scope_runme.js
  700. index fea4d2ca99..dffbcded7d 100644
  701. --- a/Examples/test-suite/javascript/rename_scope_runme.js
  702. +++ b/Examples/test-suite/javascript/rename_scope_runme.js
  703. @@ -1,4 +1,4 @@
  704. -var rename_scope = require("rename_scope");
  705. +var rename_scope = require("./rename_scope");
  706. var a = new rename_scope.Natural_UP();
  707. var b = new rename_scope.Natural_BP();
  708. @@ -15,3 +15,5 @@ var f = rename_scope.equals;
  709. if (f === undefined) {
  710. throw new Error("Equality operator has not been renamed.");
  711. }
  712. +
  713. +process.exit(0);
  714. diff --git a/Examples/test-suite/javascript/rename_simple_runme.js b/Examples/test-suite/javascript/rename_simple_runme.js
  715. index 21350cd3ee..9d39f1a62e 100644
  716. --- a/Examples/test-suite/javascript/rename_simple_runme.js
  717. +++ b/Examples/test-suite/javascript/rename_simple_runme.js
  718. @@ -1,4 +1,4 @@
  719. -var rename_simple = require("rename_simple");
  720. +var rename_simple = require("./rename_simple");
  721. var NewStruct = rename_simple.NewStruct;
  722. var s = new NewStruct();
  723. @@ -48,3 +48,5 @@ rename_simple.NewGlobalVariable = 6666;
  724. if (rename_simple.NewGlobalVariable !== 6666) {
  725. throw new Error("rename_simple.NewGlobalVariable: Expected 6666, was " + rename_simple.NewGlobalVariable);
  726. }
  727. +
  728. +process.exit(0);
  729. diff --git a/Examples/test-suite/javascript/ret_by_value_runme.js b/Examples/test-suite/javascript/ret_by_value_runme.js
  730. index 9d0840602a..e0eec07cf7 100644
  731. --- a/Examples/test-suite/javascript/ret_by_value_runme.js
  732. +++ b/Examples/test-suite/javascript/ret_by_value_runme.js
  733. @@ -1,4 +1,4 @@
  734. -var ret_by_value = require("ret_by_value");
  735. +var ret_by_value = require("./ret_by_value");
  736. a = ret_by_value.get_test();
  737. if (a.myInt != 100)
  738. @@ -6,3 +6,5 @@ if (a.myInt != 100)
  739. if (a.myShort != 200)
  740. throw "RuntimeError";
  741. +
  742. +process.exit(0);
  743. diff --git a/Examples/test-suite/javascript/string_simple_runme.js b/Examples/test-suite/javascript/string_simple_runme.js
  744. index 71fbb7bd07..21668fc05f 100644
  745. --- a/Examples/test-suite/javascript/string_simple_runme.js
  746. +++ b/Examples/test-suite/javascript/string_simple_runme.js
  747. @@ -1,4 +1,4 @@
  748. -var string_simple = require("string_simple");
  749. +var string_simple = require("./string_simple");
  750. // Test unicode string
  751. var str = "olé";
  752. @@ -8,3 +8,5 @@ var copy = string_simple.copy_str(str);
  753. if (str !== copy) {
  754. throw "Error: copy is not equal: original="+str+", copy="+copy;
  755. }
  756. +
  757. +process.exit(0);
  758. diff --git a/Examples/test-suite/javascript/struct_value_runme.js b/Examples/test-suite/javascript/struct_value_runme.js
  759. index 5b171b8fed..d277481ed0 100644
  760. --- a/Examples/test-suite/javascript/struct_value_runme.js
  761. +++ b/Examples/test-suite/javascript/struct_value_runme.js
  762. @@ -1,4 +1,4 @@
  763. -var struct_value = require("struct_value");
  764. +var struct_value = require("./struct_value");
  765. b = new struct_value.Bar();
  766. @@ -9,3 +9,5 @@ throw "RuntimeError";
  767. b.b.x = 3;
  768. if (b.b.x != 3)
  769. throw "RuntimeError"
  770. +
  771. +process.exit(0);
  772. diff --git a/Examples/test-suite/javascript/swig_exception_runme.js b/Examples/test-suite/javascript/swig_exception_runme.js
  773. index 55435e9477..257dedc8fc 100644
  774. --- a/Examples/test-suite/javascript/swig_exception_runme.js
  775. +++ b/Examples/test-suite/javascript/swig_exception_runme.js
  776. @@ -1,4 +1,4 @@
  777. -var swig_exception = require("swig_exception");
  778. +var swig_exception = require("./swig_exception");
  779. var c = new swig_exception.Circle(10);
  780. var s = new swig_exception.Square(10);
  781. @@ -28,3 +28,5 @@ if (swig_exception.Shape.nshapes != 0) {
  782. throw "Shape.nshapes should be 0, actually " + swig_exception.Shape.nshapes;
  783. }
  784. */
  785. +
  786. +process.exit(0);
  787. diff --git a/Examples/test-suite/javascript/template_static_runme.js b/Examples/test-suite/javascript/template_static_runme.js
  788. index d6106138ae..aa3e548b8d 100644
  789. --- a/Examples/test-suite/javascript/template_static_runme.js
  790. +++ b/Examples/test-suite/javascript/template_static_runme.js
  791. @@ -1,3 +1,5 @@
  792. -var template_static = require("template_static");
  793. +var template_static = require("./template_static");
  794. template_static.Foo.bar_double(1);
  795. +
  796. +process.exit(0);
  797. diff --git a/Examples/test-suite/javascript/typedef_class_runme.js b/Examples/test-suite/javascript/typedef_class_runme.js
  798. index 64e0051c37..5d6df5b6b7 100644
  799. --- a/Examples/test-suite/javascript/typedef_class_runme.js
  800. +++ b/Examples/test-suite/javascript/typedef_class_runme.js
  801. @@ -1,7 +1,9 @@
  802. -var typedef_class = require("typedef_class");
  803. +var typedef_class = require("./typedef_class");
  804. a = new typedef_class.RealA();
  805. a.a = 3;
  806. b = new typedef_class.B();
  807. b.testA(a);
  808. +
  809. +process.exit(0);
  810. diff --git a/Examples/test-suite/javascript/typedef_inherit_runme.js b/Examples/test-suite/javascript/typedef_inherit_runme.js
  811. index 7590e1e6ec..b13c59a030 100644
  812. --- a/Examples/test-suite/javascript/typedef_inherit_runme.js
  813. +++ b/Examples/test-suite/javascript/typedef_inherit_runme.js
  814. @@ -1,4 +1,4 @@
  815. -var typedef_inherit = require("typedef_inherit");
  816. +var typedef_inherit = require("./typedef_inherit");
  817. a = new typedef_inherit.Foo();
  818. b = new typedef_inherit.Bar();
  819. @@ -21,3 +21,5 @@ if (x != "Spam::blah")
  820. x = typedef_inherit.do_blah2(d);
  821. if (x != "Grok::blah")
  822. print ("Whoa! Bad return" + x);
  823. +
  824. +process.exit(0);
  825. diff --git a/Examples/test-suite/javascript/typedef_scope_runme.js b/Examples/test-suite/javascript/typedef_scope_runme.js
  826. index 5c1368ab78..e8b2a8255c 100644
  827. --- a/Examples/test-suite/javascript/typedef_scope_runme.js
  828. +++ b/Examples/test-suite/javascript/typedef_scope_runme.js
  829. @@ -1,4 +1,4 @@
  830. -var typedef_scope = require("typedef_scope");
  831. +var typedef_scope = require("./typedef_scope");
  832. b = new typedef_scope.Bar();
  833. x = b.test1(42,"hello");
  834. @@ -10,3 +10,5 @@ if (x != "hello")
  835. print("Failed!!");
  836. +
  837. +process.exit(0);
  838. diff --git a/Examples/test-suite/javascript/typemap_arrays_runme.js b/Examples/test-suite/javascript/typemap_arrays_runme.js
  839. index 610ecdd9c7..c333f43930 100644
  840. --- a/Examples/test-suite/javascript/typemap_arrays_runme.js
  841. +++ b/Examples/test-suite/javascript/typemap_arrays_runme.js
  842. @@ -1,5 +1,7 @@
  843. -var typemap_arrays = require("typemap_arrays");
  844. +var typemap_arrays = require("./typemap_arrays");
  845. if (typemap_arrays.sumA(null) != 60)
  846. throw "RuntimeError, Sum is wrong";
  847. +
  848. +process.exit(0);
  849. diff --git a/Examples/test-suite/javascript/typemap_delete_runme.js b/Examples/test-suite/javascript/typemap_delete_runme.js
  850. index 1d42ce4daf..72252fe013 100644
  851. --- a/Examples/test-suite/javascript/typemap_delete_runme.js
  852. +++ b/Examples/test-suite/javascript/typemap_delete_runme.js
  853. @@ -1,5 +1,7 @@
  854. -var typemap_delete = require("typemap_delete");
  855. +var typemap_delete = require("./typemap_delete");
  856. r = new typemap_delete.Rect(123);
  857. if (r.val != 123)
  858. throw "RuntimeError";
  859. +
  860. +process.exit(0);
  861. diff --git a/Examples/test-suite/javascript/typemap_namespace_runme.js b/Examples/test-suite/javascript/typemap_namespace_runme.js
  862. index 2aa3580249..962e54afa4 100644
  863. --- a/Examples/test-suite/javascript/typemap_namespace_runme.js
  864. +++ b/Examples/test-suite/javascript/typemap_namespace_runme.js
  865. @@ -1,7 +1,9 @@
  866. -var typemap_namespace = require("typemap_namespace");
  867. +var typemap_namespace = require("./typemap_namespace");
  868. if (typemap_namespace.test1("hello") != "hello")
  869. throw "RuntimeError";
  870. if (typemap_namespace.test2("hello") != "hello")
  871. throw "RuntimeError";
  872. +
  873. +process.exit(0);
  874. diff --git a/Examples/test-suite/javascript/typemap_ns_using_runme.js b/Examples/test-suite/javascript/typemap_ns_using_runme.js
  875. index 7e4019ab24..e97ea473c6 100644
  876. --- a/Examples/test-suite/javascript/typemap_ns_using_runme.js
  877. +++ b/Examples/test-suite/javascript/typemap_ns_using_runme.js
  878. @@ -1,4 +1,6 @@
  879. -var typemap_ns_using = require("typemap_ns_using");
  880. +var typemap_ns_using = require("./typemap_ns_using");
  881. if (typemap_ns_using.spam(37) != 37)
  882. throw "RuntimeError";
  883. +
  884. +process.exit(0);
  885. diff --git a/Examples/test-suite/javascript/using1_runme.js b/Examples/test-suite/javascript/using1_runme.js
  886. index 2415156f08..68917b0156 100644
  887. --- a/Examples/test-suite/javascript/using1_runme.js
  888. +++ b/Examples/test-suite/javascript/using1_runme.js
  889. @@ -1,4 +1,6 @@
  890. -var using1 = require("using1");
  891. +var using1 = require("./using1");
  892. if (using1.spam(37) != 37)
  893. throw "RuntimeError";
  894. +
  895. +process.exit(0);
  896. diff --git a/Examples/test-suite/javascript/using2_runme.js b/Examples/test-suite/javascript/using2_runme.js
  897. index 2ef08faca1..001f551403 100644
  898. --- a/Examples/test-suite/javascript/using2_runme.js
  899. +++ b/Examples/test-suite/javascript/using2_runme.js
  900. @@ -1,4 +1,6 @@
  901. -var using2 = require("using2");
  902. +var using2 = require("./using2");
  903. if (using2.spam(37) != 37)
  904. throw "RuntimeError";
  905. +
  906. +process.exit(0);
  907. diff --git a/Examples/test-suite/javascript/varargs_runme.js b/Examples/test-suite/javascript/varargs_runme.js
  908. index fc6d945c1a..66348f2983 100644
  909. --- a/Examples/test-suite/javascript/varargs_runme.js
  910. +++ b/Examples/test-suite/javascript/varargs_runme.js
  911. @@ -1,4 +1,4 @@
  912. -var varargs = require("varargs");
  913. +var varargs = require("./varargs");
  914. if (varargs.test("Hello") != "Hello") {
  915. throw new Error("Failed");
  916. @@ -42,3 +42,5 @@ try {
  917. if (!thrown) {
  918. throw new Error("Failed");
  919. }
  920. +
  921. +process.exit(0);
  922. diff --git a/Lib/javascript/v8/javascriptcode.swg b/Lib/javascript/v8/javascriptcode.swg
  923. index c4aaf3db0c..c2aacc61a5 100644
  924. --- a/Lib/javascript/v8/javascriptcode.swg
  925. +++ b/Lib/javascript/v8/javascriptcode.swg
  926. @@ -11,7 +11,7 @@
  927. static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) {
  928. SWIGV8_HANDLESCOPE();
  929. - v8::Handle<v8::Object> self = args.Holder();
  930. + v8::Local<v8::Object> self = args.Holder();
  931. $jslocals
  932. if(args.Length() != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
  933. $jscode
  934. @@ -53,7 +53,7 @@ static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) {
  935. SWIGV8_HANDLESCOPE();
  936. OverloadErrorHandler errorHandler;
  937. - v8::Handle<v8::Value> self;
  938. + v8::Local<v8::Value> self;
  939. // switch all cases by means of series of if-returns.
  940. $jsdispatchcases
  941. @@ -78,7 +78,7 @@ fail:
  942. static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args, V8ErrorHandler &SWIGV8_ErrorHandler) {
  943. SWIGV8_HANDLESCOPE();
  944. - v8::Handle<v8::Object> self = args.Holder();
  945. + v8::Local<v8::Object> self = args.Holder();
  946. $jslocals
  947. if(args.Length() != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
  948. $jscode
  949. @@ -226,7 +226,7 @@ static SwigV8ReturnValue $jswrapper(v8::Local<v8::Name> property, const SwigV8Pr
  950. #endif
  951. SWIGV8_HANDLESCOPE();
  952. - v8::Handle<v8::Value> jsresult;
  953. + v8::Local<v8::Value> jsresult;
  954. $jslocals
  955. $jscode
  956. SWIGV8_RETURN_INFO(jsresult, info);
  957. @@ -271,7 +271,7 @@ fail:
  958. static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) {
  959. SWIGV8_HANDLESCOPE();
  960. - v8::Handle<v8::Value> jsresult;
  961. + v8::Local<v8::Value> jsresult;
  962. $jslocals
  963. if(args.Length() != $jsargcount) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for $jswrapper.");
  964. @@ -296,7 +296,7 @@ fail:
  965. static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args) {
  966. SWIGV8_HANDLESCOPE();
  967. - v8::Handle<v8::Value> jsresult;
  968. + v8::Local<v8::Value> jsresult;
  969. OverloadErrorHandler errorHandler;
  970. $jscode
  971. @@ -320,7 +320,7 @@ static SwigV8ReturnValue $jswrapper(const SwigV8Arguments &args, V8ErrorHandler
  972. {
  973. SWIGV8_HANDLESCOPE();
  974. - v8::Handle<v8::Value> jsresult;
  975. + v8::Local<v8::Value> jsresult;
  976. $jslocals
  977. $jscode
  978. SWIGV8_RETURN(jsresult);
  979. @@ -374,7 +374,7 @@ fail:
  980. %fragment("jsv8_define_class_template", "templates")
  981. %{
  982. /* Name: $jsmangledname, Type: $jsmangledtype, Dtor: $jsdtor */
  983. - v8::Handle<v8::FunctionTemplate> $jsmangledname_class = SWIGV8_CreateClassTemplate("$jsmangledname");
  984. + v8::Local<v8::FunctionTemplate> $jsmangledname_class = SWIGV8_CreateClassTemplate("$jsmangledname");
  985. SWIGV8_SET_CLASS_TEMPL($jsmangledname_clientData.class_templ, $jsmangledname_class);
  986. $jsmangledname_clientData.dtor = $jsdtor;
  987. if (SWIGTYPE_$jsmangledtype->clientdata == 0) {
  988. @@ -420,11 +420,15 @@ fail:
  989. %fragment("jsv8_create_class_instance", "templates")
  990. %{
  991. /* Class: $jsname ($jsmangledname) */
  992. - v8::Handle<v8::FunctionTemplate> $jsmangledname_class_0 = SWIGV8_CreateClassTemplate("$jsname");
  993. + v8::Local<v8::FunctionTemplate> $jsmangledname_class_0 = SWIGV8_CreateClassTemplate("$jsname");
  994. $jsmangledname_class_0->SetCallHandler($jsctor);
  995. $jsmangledname_class_0->Inherit($jsmangledname_class);
  996. +#if (SWIG_V8_VERSION < 0x0705)
  997. $jsmangledname_class_0->SetHiddenPrototype(true);
  998. - v8::Handle<v8::Object> $jsmangledname_obj = $jsmangledname_class_0->GetFunction();
  999. + v8::Local<v8::Object> $jsmangledname_obj = $jsmangledname_class_0->GetFunction();
  1000. +#else
  1001. + v8::Local<v8::Object> $jsmangledname_obj = $jsmangledname_class_0->GetFunction(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked();
  1002. +#endif
  1003. %}
  1004. /* -----------------------------------------------------------------------------
  1005. @@ -435,7 +439,11 @@ fail:
  1006. * ----------------------------------------------------------------------------- */
  1007. %fragment("jsv8_register_class", "templates")
  1008. %{
  1009. +#if (SWIG_V8_VERSION < 0x0706)
  1010. $jsparent_obj->Set(SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj);
  1011. +#else
  1012. + $jsparent_obj->Set(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW("$jsname"), $jsmangledname_obj);
  1013. +#endif
  1014. %}
  1015. /* -----------------------------------------------------------------------------
  1016. @@ -444,7 +452,7 @@ fail:
  1017. * ----------------------------------------------------------------------------- */
  1018. %fragment("jsv8_create_namespace", "templates")
  1019. %{
  1020. - v8::Handle<v8::Object> $jsmangledname_obj = SWIGV8_OBJECT_NEW();
  1021. + v8::Local<v8::Object> $jsmangledname_obj = SWIGV8_OBJECT_NEW();
  1022. %}
  1023. /* -----------------------------------------------------------------------------
  1024. diff --git a/Lib/javascript/v8/javascriptcomplex.swg b/Lib/javascript/v8/javascriptcomplex.swg
  1025. index d3b4aaffa6..533e548131 100644
  1026. --- a/Lib/javascript/v8/javascriptcomplex.swg
  1027. +++ b/Lib/javascript/v8/javascriptcomplex.swg
  1028. @@ -12,7 +12,7 @@
  1029. %fragment(SWIG_From_frag(Type),"header",
  1030. fragment=SWIG_From_frag(double))
  1031. {
  1032. -SWIGINTERNINLINE v8::Handle<v8::Value>
  1033. +SWIGINTERNINLINE v8::Local<v8::Value>
  1034. SWIG_From_dec(Type)(%ifcplusplus(const Type&, Type) c)
  1035. {
  1036. SWIGV8_HANDLESCOPE_ESC();
  1037. @@ -32,12 +32,12 @@ SWIG_From_dec(Type)(%ifcplusplus(const Type&, Type) c)
  1038. fragment=SWIG_AsVal_frag(double))
  1039. {
  1040. SWIGINTERN int
  1041. -SWIG_AsVal_dec(Type) (v8::Handle<v8::Value> o, Type* val)
  1042. +SWIG_AsVal_dec(Type) (v8::Local<v8::Value> o, Type* val)
  1043. {
  1044. SWIGV8_HANDLESCOPE();
  1045. if (o->IsArray()) {
  1046. - v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(o);
  1047. + v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(o);
  1048. if(array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2].");
  1049. double re, im;
  1050. @@ -74,12 +74,12 @@ SWIG_AsVal_dec(Type) (v8::Handle<v8::Value> o, Type* val)
  1051. %fragment(SWIG_AsVal_frag(Type),"header",
  1052. fragment=SWIG_AsVal_frag(float)) {
  1053. SWIGINTERN int
  1054. -SWIG_AsVal_dec(Type) (v8::Handle<v8::Value> o, Type* val)
  1055. +SWIG_AsVal_dec(Type) (v8::Local<v8::Value> o, Type* val)
  1056. {
  1057. SWIGV8_HANDLESCOPE();
  1058. if (o->IsArray()) {
  1059. - v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(o);
  1060. + v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(o);
  1061. if(array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2].");
  1062. double re, im;
  1063. diff --git a/Lib/javascript/v8/javascripthelpers.swg b/Lib/javascript/v8/javascripthelpers.swg
  1064. index 80fbd7aa1a..0cd24a1942 100644
  1065. --- a/Lib/javascript/v8/javascripthelpers.swg
  1066. +++ b/Lib/javascript/v8/javascripthelpers.swg
  1067. @@ -21,19 +21,19 @@ typedef v8::PropertyCallbackInfo<void> SwigV8PropertyCallbackInfoVoid;
  1068. /**
  1069. * Creates a class template for a class with specified initialization function.
  1070. */
  1071. -SWIGRUNTIME v8::Handle<v8::FunctionTemplate> SWIGV8_CreateClassTemplate(const char* symbol) {
  1072. +SWIGRUNTIME v8::Local<v8::FunctionTemplate> SWIGV8_CreateClassTemplate(const char* symbol) {
  1073. SWIGV8_HANDLESCOPE_ESC();
  1074. v8::Local<v8::FunctionTemplate> class_templ = SWIGV8_FUNCTEMPLATE_NEW_VOID();
  1075. class_templ->SetClassName(SWIGV8_SYMBOL_NEW(symbol));
  1076. - v8::Handle<v8::ObjectTemplate> inst_templ = class_templ->InstanceTemplate();
  1077. + v8::Local<v8::ObjectTemplate> inst_templ = class_templ->InstanceTemplate();
  1078. inst_templ->SetInternalFieldCount(1);
  1079. - v8::Handle<v8::ObjectTemplate> equals_templ = class_templ->PrototypeTemplate();
  1080. + v8::Local<v8::ObjectTemplate> equals_templ = class_templ->PrototypeTemplate();
  1081. equals_templ->Set(SWIGV8_SYMBOL_NEW("equals"), SWIGV8_FUNCTEMPLATE_NEW(_SWIGV8_wrap_equals));
  1082. - v8::Handle<v8::ObjectTemplate> cptr_templ = class_templ->PrototypeTemplate();
  1083. + v8::Local<v8::ObjectTemplate> cptr_templ = class_templ->PrototypeTemplate();
  1084. cptr_templ->Set(SWIGV8_SYMBOL_NEW("getCPtr"), SWIGV8_FUNCTEMPLATE_NEW(_wrap_getCPtr));
  1085. SWIGV8_ESCAPE(class_templ);
  1086. @@ -42,33 +42,39 @@ SWIGRUNTIME v8::Handle<v8::FunctionTemplate> SWIGV8_CreateClassTemplate(const ch
  1087. /**
  1088. * Registers a class method with given name for a given class template.
  1089. */
  1090. -SWIGRUNTIME void SWIGV8_AddMemberFunction(v8::Handle<v8::FunctionTemplate> class_templ, const char* symbol,
  1091. +SWIGRUNTIME void SWIGV8_AddMemberFunction(v8::Local<v8::FunctionTemplate> class_templ, const char* symbol,
  1092. SwigV8FunctionCallback _func) {
  1093. - v8::Handle<v8::ObjectTemplate> proto_templ = class_templ->PrototypeTemplate();
  1094. + v8::Local<v8::ObjectTemplate> proto_templ = class_templ->PrototypeTemplate();
  1095. proto_templ->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func));
  1096. }
  1097. /**
  1098. * Registers a class property with given name for a given class template.
  1099. */
  1100. -SWIGRUNTIME void SWIGV8_AddMemberVariable(v8::Handle<v8::FunctionTemplate> class_templ, const char* symbol,
  1101. +SWIGRUNTIME void SWIGV8_AddMemberVariable(v8::Local<v8::FunctionTemplate> class_templ, const char* symbol,
  1102. SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) {
  1103. - v8::Handle<v8::ObjectTemplate> proto_templ = class_templ->InstanceTemplate();
  1104. + v8::Local<v8::ObjectTemplate> proto_templ = class_templ->InstanceTemplate();
  1105. proto_templ->SetAccessor(SWIGV8_SYMBOL_NEW(symbol), getter, setter);
  1106. }
  1107. /**
  1108. * Registers a class method with given name for a given object.
  1109. */
  1110. -SWIGRUNTIME void SWIGV8_AddStaticFunction(v8::Handle<v8::Object> obj, const char* symbol,
  1111. +SWIGRUNTIME void SWIGV8_AddStaticFunction(v8::Local<v8::Object> obj, const char* symbol,
  1112. const SwigV8FunctionCallback& _func) {
  1113. +#if (SWIG_V8_VERSION < 0x0705)
  1114. obj->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction());
  1115. +#elif (SWIG_V8_VERSION < 0x0706)
  1116. + obj->Set(SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked());
  1117. +#else
  1118. + obj->Set(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW(symbol), SWIGV8_FUNCTEMPLATE_NEW(_func)->GetFunction(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked());
  1119. +#endif
  1120. }
  1121. /**
  1122. * Registers a class method with given name for a given object.
  1123. */
  1124. -SWIGRUNTIME void SWIGV8_AddStaticVariable(v8::Handle<v8::Object> obj, const char* symbol,
  1125. +SWIGRUNTIME void SWIGV8_AddStaticVariable(v8::Local<v8::Object> obj, const char* symbol,
  1126. SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) {
  1127. #if (V8_MAJOR_VERSION-0) < 5
  1128. obj->SetAccessor(SWIGV8_SYMBOL_NEW(symbol), getter, setter);
  1129. diff --git a/Lib/javascript/v8/javascriptinit.swg b/Lib/javascript/v8/javascriptinit.swg
  1130. index 8faf2dd8e1..450aa9c6d9 100644
  1131. --- a/Lib/javascript/v8/javascriptinit.swg
  1132. +++ b/Lib/javascript/v8/javascriptinit.swg
  1133. @@ -70,14 +70,14 @@ extern "C"
  1134. #if (NODE_MODULE_VERSION < 0x000C)
  1135. void SWIGV8_INIT (v8::Handle<v8::Object> exports)
  1136. #else
  1137. -void SWIGV8_INIT (v8::Handle<v8::Object> exports, v8::Handle<v8::Object> /*module*/)
  1138. +void SWIGV8_INIT (v8::Local<v8::Object> exports, v8::Local<v8::Object> /*module*/)
  1139. #endif
  1140. {
  1141. SWIG_InitializeModule(static_cast<void *>(&exports));
  1142. SWIGV8_HANDLESCOPE();
  1143. - v8::Handle<v8::Object> exports_obj = exports;
  1144. + v8::Local<v8::Object> exports_obj = exports;
  1145. %}
  1146. diff --git a/Lib/javascript/v8/javascriptprimtypes.swg b/Lib/javascript/v8/javascriptprimtypes.swg
  1147. index f76be983b1..24f5daf7c5 100644
  1148. --- a/Lib/javascript/v8/javascriptprimtypes.swg
  1149. +++ b/Lib/javascript/v8/javascriptprimtypes.swg
  1150. @@ -6,7 +6,7 @@
  1151. %fragment(SWIG_From_frag(bool),"header") {
  1152. SWIGINTERNINLINE
  1153. -v8::Handle<v8::Value>
  1154. +v8::Local<v8::Value>
  1155. SWIG_From_dec(bool)(bool value)
  1156. {
  1157. return SWIGV8_BOOLEAN_NEW(value);
  1158. @@ -16,7 +16,7 @@ SWIG_From_dec(bool)(bool value)
  1159. %fragment(SWIG_AsVal_frag(bool),"header",
  1160. fragment=SWIG_AsVal_frag(long)) {
  1161. SWIGINTERN
  1162. -int SWIG_AsVal_dec(bool)(v8::Handle<v8::Value> obj, bool *val)
  1163. +int SWIG_AsVal_dec(bool)(v8::Local<v8::Value> obj, bool *val)
  1164. {
  1165. if(!obj->IsBoolean()) {
  1166. return SWIG_ERROR;
  1167. @@ -31,7 +31,7 @@ int SWIG_AsVal_dec(bool)(v8::Handle<v8::Value> obj, bool *val)
  1168. %fragment(SWIG_From_frag(int),"header") {
  1169. SWIGINTERNINLINE
  1170. -v8::Handle<v8::Value> SWIG_From_dec(int)(int value)
  1171. +v8::Local<v8::Value> SWIG_From_dec(int)(int value)
  1172. {
  1173. return SWIGV8_INT32_NEW(value);
  1174. }
  1175. @@ -39,7 +39,7 @@ v8::Handle<v8::Value> SWIG_From_dec(int)(int value)
  1176. %fragment(SWIG_AsVal_frag(int),"header") {
  1177. SWIGINTERN
  1178. -int SWIG_AsVal_dec(int)(v8::Handle<v8::Value> valRef, int* val)
  1179. +int SWIG_AsVal_dec(int)(v8::Local<v8::Value> valRef, int* val)
  1180. {
  1181. if (!valRef->IsNumber()) {
  1182. return SWIG_TypeError;
  1183. @@ -54,7 +54,7 @@ int SWIG_AsVal_dec(int)(v8::Handle<v8::Value> valRef, int* val)
  1184. %fragment(SWIG_From_frag(long),"header") {
  1185. SWIGINTERNINLINE
  1186. -v8::Handle<v8::Value> SWIG_From_dec(long)(long value)
  1187. +v8::Local<v8::Value> SWIG_From_dec(long)(long value)
  1188. {
  1189. return SWIGV8_NUMBER_NEW(value);
  1190. }
  1191. @@ -63,7 +63,7 @@ v8::Handle<v8::Value> SWIG_From_dec(long)(long value)
  1192. %fragment(SWIG_AsVal_frag(long),"header",
  1193. fragment="SWIG_CanCastAsInteger") {
  1194. SWIGINTERN
  1195. -int SWIG_AsVal_dec(long)(v8::Handle<v8::Value> obj, long* val)
  1196. +int SWIG_AsVal_dec(long)(v8::Local<v8::Value> obj, long* val)
  1197. {
  1198. if (!obj->IsNumber()) {
  1199. return SWIG_TypeError;
  1200. @@ -79,7 +79,7 @@ int SWIG_AsVal_dec(long)(v8::Handle<v8::Value> obj, long* val)
  1201. %fragment(SWIG_From_frag(unsigned long),"header",
  1202. fragment=SWIG_From_frag(long)) {
  1203. SWIGINTERNINLINE
  1204. -v8::Handle<v8::Value> SWIG_From_dec(unsigned long)(unsigned long value)
  1205. +v8::Local<v8::Value> SWIG_From_dec(unsigned long)(unsigned long value)
  1206. {
  1207. return (value > LONG_MAX) ?
  1208. SWIGV8_INTEGER_NEW_UNS(value) : SWIGV8_INTEGER_NEW(%numeric_cast(value,long));
  1209. @@ -89,7 +89,7 @@ v8::Handle<v8::Value> SWIG_From_dec(unsigned long)(unsigned long value)
  1210. %fragment(SWIG_AsVal_frag(unsigned long),"header",
  1211. fragment="SWIG_CanCastAsInteger") {
  1212. SWIGINTERN
  1213. -int SWIG_AsVal_dec(unsigned long)(v8::Handle<v8::Value> obj, unsigned long *val)
  1214. +int SWIG_AsVal_dec(unsigned long)(v8::Local<v8::Value> obj, unsigned long *val)
  1215. {
  1216. if(!obj->IsNumber()) {
  1217. return SWIG_TypeError;
  1218. @@ -115,7 +115,7 @@ int SWIG_AsVal_dec(unsigned long)(v8::Handle<v8::Value> obj, unsigned long *val)
  1219. fragment="SWIG_LongLongAvailable") {
  1220. %#ifdef SWIG_LONG_LONG_AVAILABLE
  1221. SWIGINTERNINLINE
  1222. -v8::Handle<v8::Value> SWIG_From_dec(long long)(long long value)
  1223. +v8::Local<v8::Value> SWIG_From_dec(long long)(long long value)
  1224. {
  1225. return SWIGV8_NUMBER_NEW(value);
  1226. }
  1227. @@ -128,7 +128,7 @@ v8::Handle<v8::Value> SWIG_From_dec(long long)(long long value)
  1228. fragment="SWIG_LongLongAvailable") {
  1229. %#ifdef SWIG_LONG_LONG_AVAILABLE
  1230. SWIGINTERN
  1231. -int SWIG_AsVal_dec(long long)(v8::Handle<v8::Value> obj, long long* val)
  1232. +int SWIG_AsVal_dec(long long)(v8::Local<v8::Value> obj, long long* val)
  1233. {
  1234. if (!obj->IsNumber()) {
  1235. return SWIG_TypeError;
  1236. @@ -148,7 +148,7 @@ int SWIG_AsVal_dec(long long)(v8::Handle<v8::Value> obj, long long* val)
  1237. fragment="SWIG_LongLongAvailable") {
  1238. %#ifdef SWIG_LONG_LONG_AVAILABLE
  1239. SWIGINTERNINLINE
  1240. -v8::Handle<v8::Value> SWIG_From_dec(unsigned long long)(unsigned long long value)
  1241. +v8::Local<v8::Value> SWIG_From_dec(unsigned long long)(unsigned long long value)
  1242. {
  1243. return (value > LONG_MAX) ?
  1244. SWIGV8_INTEGER_NEW_UNS(value) : SWIGV8_INTEGER_NEW(%numeric_cast(value,long));
  1245. @@ -162,7 +162,7 @@ v8::Handle<v8::Value> SWIG_From_dec(unsigned long long)(unsigned long long value
  1246. fragment="SWIG_LongLongAvailable") {
  1247. %#ifdef SWIG_LONG_LONG_AVAILABLE
  1248. SWIGINTERN
  1249. -int SWIG_AsVal_dec(unsigned long long)(v8::Handle<v8::Value> obj, unsigned long long *val)
  1250. +int SWIG_AsVal_dec(unsigned long long)(v8::Local<v8::Value> obj, unsigned long long *val)
  1251. {
  1252. if(!obj->IsNumber()) {
  1253. return SWIG_TypeError;
  1254. @@ -185,7 +185,7 @@ int SWIG_AsVal_dec(unsigned long long)(v8::Handle<v8::Value> obj, unsigned long
  1255. %fragment(SWIG_From_frag(double),"header") {
  1256. SWIGINTERN
  1257. -v8::Handle<v8::Value> SWIG_From_dec(double) (double val)
  1258. +v8::Local<v8::Value> SWIG_From_dec(double) (double val)
  1259. {
  1260. return SWIGV8_NUMBER_NEW(val);
  1261. }
  1262. @@ -193,7 +193,7 @@ v8::Handle<v8::Value> SWIG_From_dec(double) (double val)
  1263. %fragment(SWIG_AsVal_frag(double),"header") {
  1264. SWIGINTERN
  1265. -int SWIG_AsVal_dec(double)(v8::Handle<v8::Value> obj, double *val)
  1266. +int SWIG_AsVal_dec(double)(v8::Local<v8::Value> obj, double *val)
  1267. {
  1268. if(!obj->IsNumber()) {
  1269. return SWIG_TypeError;
  1270. diff --git a/Lib/javascript/v8/javascriptrun.swg b/Lib/javascript/v8/javascriptrun.swg
  1271. index 2452f4040d..db6299a84e 100644
  1272. --- a/Lib/javascript/v8/javascriptrun.swg
  1273. +++ b/Lib/javascript/v8/javascriptrun.swg
  1274. @@ -10,7 +10,11 @@
  1275. #if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031803)
  1276. #define SWIGV8_STRING_NEW2(cstr, len) v8::String::New(cstr, len)
  1277. #else
  1278. +#if (SWIG_V8_VERSION < 0x0706)
  1279. #define SWIGV8_STRING_NEW2(cstr, len) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), cstr, v8::String::kNormalString, len)
  1280. +#else
  1281. +#define SWIGV8_STRING_NEW2(cstr, len) (v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), cstr, v8::NewStringType::kNormal, len)).ToLocalChecked()
  1282. +#endif
  1283. #endif
  1284. #if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
  1285. @@ -47,12 +51,18 @@ typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
  1286. #define SWIGV8_THROW_EXCEPTION(err) v8::ThrowException(err)
  1287. #define SWIGV8_STRING_NEW(str) v8::String::New(str)
  1288. #define SWIGV8_SYMBOL_NEW(sym) v8::String::NewSymbol(sym)
  1289. +#elif (SWIG_V8_VERSION < 0x0706)
  1290. +#define SWIGV8_ADJUST_MEMORY(size) v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(size)
  1291. +#define SWIGV8_CURRENT_CONTEXT() v8::Isolate::GetCurrent()->GetCurrentContext()
  1292. +#define SWIGV8_THROW_EXCEPTION(err) v8::Isolate::GetCurrent()->ThrowException(err)
  1293. +#define SWIGV8_STRING_NEW(str) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), str, v8::String::kNormalString)
  1294. +#define SWIGV8_SYMBOL_NEW(sym) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), sym, v8::String::kNormalString)
  1295. #else
  1296. #define SWIGV8_ADJUST_MEMORY(size) v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(size)
  1297. #define SWIGV8_CURRENT_CONTEXT() v8::Isolate::GetCurrent()->GetCurrentContext()
  1298. #define SWIGV8_THROW_EXCEPTION(err) v8::Isolate::GetCurrent()->ThrowException(err)
  1299. -#define SWIGV8_STRING_NEW(str) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), str)
  1300. -#define SWIGV8_SYMBOL_NEW(sym) v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), sym)
  1301. +#define SWIGV8_STRING_NEW(str) (v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), str, v8::NewStringType::kNormal)).ToLocalChecked()
  1302. +#define SWIGV8_SYMBOL_NEW(sym) (v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), sym, v8::NewStringType::kNormal)).ToLocalChecked()
  1303. #endif
  1304. #if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032318)
  1305. @@ -107,7 +117,7 @@ typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
  1306. #define SWIGV8_BOOLEAN_VALUE(handle) (handle)->BooleanValue()
  1307. #define SWIGV8_WRITE_UTF8(handle, buffer, len) (handle)->WriteUtf8(buffer, len)
  1308. #define SWIGV8_UTF8_LENGTH(handle) (handle)->Utf8Length()
  1309. -#else
  1310. +#elif (SWIG_V8_VERSION < 0x0706)
  1311. #define SWIGV8_TO_OBJECT(handle) (handle)->ToObject(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked()
  1312. #define SWIGV8_TO_STRING(handle) (handle)->ToString(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked()
  1313. #define SWIGV8_NUMBER_VALUE(handle) (handle)->NumberValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
  1314. @@ -115,6 +125,14 @@ typedef v8::PropertyCallbackInfo<v8::Value> SwigV8PropertyCallbackInfo;
  1315. #define SWIGV8_BOOLEAN_VALUE(handle) (handle)->BooleanValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
  1316. #define SWIGV8_WRITE_UTF8(handle, buffer, len) (handle)->WriteUtf8(v8::Isolate::GetCurrent(), buffer, len)
  1317. #define SWIGV8_UTF8_LENGTH(handle) (handle)->Utf8Length(v8::Isolate::GetCurrent())
  1318. +#else
  1319. +#define SWIGV8_TO_OBJECT(handle) (handle)->ToObject(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked()
  1320. +#define SWIGV8_TO_STRING(handle) (handle)->ToString(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked()
  1321. +#define SWIGV8_NUMBER_VALUE(handle) (handle)->NumberValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
  1322. +#define SWIGV8_INTEGER_VALUE(handle) (handle)->IntegerValue(SWIGV8_CURRENT_CONTEXT()).ToChecked()
  1323. +#define SWIGV8_BOOLEAN_VALUE(handle) (handle)->BooleanValue(v8::Isolate::GetCurrent())
  1324. +#define SWIGV8_WRITE_UTF8(handle, buffer, len) (handle)->WriteUtf8(v8::Isolate::GetCurrent(), buffer, len)
  1325. +#define SWIGV8_UTF8_LENGTH(handle) (handle)->Utf8Length(v8::Isolate::GetCurrent())
  1326. #endif
  1327. /* ---------------------------------------------------------------------------
  1328. @@ -163,7 +181,7 @@ public:
  1329. SWIGV8_THROW_EXCEPTION(err);
  1330. }
  1331. }
  1332. - v8::Handle<v8::Value> err;
  1333. + v8::Local<v8::Value> err;
  1334. };
  1335. /* ---------------------------------------------------------------------------
  1336. @@ -228,13 +246,13 @@ public:
  1337. SWIGRUNTIME v8::Persistent<v8::FunctionTemplate> SWIGV8_SWIGTYPE_Proxy_class_templ;
  1338. -SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(v8::Handle<v8::Object> objRef, void **ptr, swig_type_info *info, int flags) {
  1339. +SWIGRUNTIME int SWIG_V8_ConvertInstancePtr(v8::Local<v8::Object> objRef, void **ptr, swig_type_info *info, int flags) {
  1340. SWIGV8_HANDLESCOPE();
  1341. if(objRef->InternalFieldCount() < 1) return SWIG_ERROR;
  1342. #if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511)
  1343. - v8::Handle<v8::Value> cdataRef = objRef->GetInternalField(0);
  1344. + v8::Local<v8::Value> cdataRef = objRef->GetInternalField(0);
  1345. SWIGV8_Proxy *cdata = static_cast<SWIGV8_Proxy *>(v8::External::Unwrap(cdataRef));
  1346. #else
  1347. SWIGV8_Proxy *cdata = static_cast<SWIGV8_Proxy *>(objRef->GetAlignedPointerFromInternalField(0));
  1348. @@ -280,11 +298,11 @@ SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(const v8::WeakCallbackInfo<SWIGV8_Prox
  1349. delete proxy;
  1350. }
  1351. -SWIGRUNTIME int SWIG_V8_GetInstancePtr(v8::Handle<v8::Value> valRef, void **ptr) {
  1352. +SWIGRUNTIME int SWIG_V8_GetInstancePtr(v8::Local<v8::Value> valRef, void **ptr) {
  1353. if(!valRef->IsObject()) {
  1354. return SWIG_TypeError;
  1355. }
  1356. - v8::Handle<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
  1357. + v8::Local<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
  1358. if(objRef->InternalFieldCount() < 1) return SWIG_ERROR;
  1359. @@ -304,7 +322,7 @@ SWIGRUNTIME int SWIG_V8_GetInstancePtr(v8::Handle<v8::Value> valRef, void **ptr)
  1360. return SWIG_OK;
  1361. }
  1362. -SWIGRUNTIME void SWIGV8_SetPrivateData(v8::Handle<v8::Object> obj, void *ptr, swig_type_info *info, int flags) {
  1363. +SWIGRUNTIME void SWIGV8_SetPrivateData(v8::Local<v8::Object> obj, void *ptr, swig_type_info *info, int flags) {
  1364. SWIGV8_Proxy *cdata = new SWIGV8_Proxy();
  1365. cdata->swigCObject = ptr;
  1366. cdata->swigCMemOwn = (flags & SWIG_POINTER_OWN) ? 1 : 0;
  1367. @@ -361,13 +379,15 @@ SWIGRUNTIME void SWIGV8_SetPrivateData(v8::Handle<v8::Object> obj, void *ptr, sw
  1368. cdata->handle.MarkIndependent();
  1369. #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
  1370. cdata->handle.MarkIndependent(v8::Isolate::GetCurrent());
  1371. -#else
  1372. +#elif (SWIG_V8_VERSION < 0x0706)
  1373. cdata->handle.MarkIndependent();
  1374. +// Looks like future versions do not require that anymore:
  1375. +// https://monorail-prod.appspot.com/p/chromium/issues/detail?id=923361#c11
  1376. #endif
  1377. }
  1378. -SWIGRUNTIME int SWIG_V8_ConvertPtr(v8::Handle<v8::Value> valRef, void **ptr, swig_type_info *info, int flags) {
  1379. +SWIGRUNTIME int SWIG_V8_ConvertPtr(v8::Local<v8::Value> valRef, void **ptr, swig_type_info *info, int flags) {
  1380. SWIGV8_HANDLESCOPE();
  1381. /* special case: JavaScript null => C NULL pointer */
  1382. @@ -378,14 +398,14 @@ SWIGRUNTIME int SWIG_V8_ConvertPtr(v8::Handle<v8::Value> valRef, void **ptr, swi
  1383. if(!valRef->IsObject()) {
  1384. return SWIG_TypeError;
  1385. }
  1386. - v8::Handle<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
  1387. + v8::Local<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
  1388. return SWIG_V8_ConvertInstancePtr(objRef, ptr, info, flags);
  1389. }
  1390. -SWIGRUNTIME v8::Handle<v8::Value> SWIG_V8_NewPointerObj(void *ptr, swig_type_info *info, int flags) {
  1391. +SWIGRUNTIME v8::Local<v8::Value> SWIG_V8_NewPointerObj(void *ptr, swig_type_info *info, int flags) {
  1392. SWIGV8_HANDLESCOPE_ESC();
  1393. - v8::Handle<v8::FunctionTemplate> class_templ;
  1394. + v8::Local<v8::FunctionTemplate> class_templ;
  1395. if (ptr == NULL) {
  1396. #if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
  1397. @@ -412,8 +432,11 @@ SWIGRUNTIME v8::Handle<v8::Value> SWIG_V8_NewPointerObj(void *ptr, swig_type_inf
  1398. }
  1399. #endif
  1400. -// v8::Handle<v8::Object> result = class_templ->InstanceTemplate()->NewInstance();
  1401. +#if (SWIG_V8_VERSION < 0x0705)
  1402. v8::Local<v8::Object> result = class_templ->InstanceTemplate()->NewInstance();
  1403. +#else
  1404. + v8::Local<v8::Object> result = class_templ->InstanceTemplate()->NewInstance(SWIGV8_CURRENT_CONTEXT()).ToLocalChecked();
  1405. +#endif
  1406. SWIGV8_SetPrivateData(result, ptr, info, flags);
  1407. SWIGV8_ESCAPE(result);
  1408. @@ -433,7 +456,7 @@ SWIGRUNTIME v8::Handle<v8::Value> SWIG_V8_NewPointerObj(void *ptr, swig_type_inf
  1409. SWIGRUNTIME SwigV8ReturnValue _SWIGV8_wrap_equals(const SwigV8Arguments &args) {
  1410. SWIGV8_HANDLESCOPE();
  1411. - v8::Handle<v8::Value> jsresult;
  1412. + v8::Local<v8::Value> jsresult;
  1413. void *arg1 = (void *) 0 ;
  1414. void *arg2 = (void *) 0 ;
  1415. bool result;
  1416. @@ -463,7 +486,7 @@ fail:
  1417. SWIGRUNTIME SwigV8ReturnValue _wrap_getCPtr(const SwigV8Arguments &args) {
  1418. SWIGV8_HANDLESCOPE();
  1419. - v8::Handle<v8::Value> jsresult;
  1420. + v8::Local<v8::Value> jsresult;
  1421. void *arg1 = (void *) 0 ;
  1422. long result;
  1423. int res1;
  1424. @@ -502,10 +525,10 @@ public:
  1425. };
  1426. SWIGRUNTIMEINLINE
  1427. -int SwigV8Packed_Check(v8::Handle<v8::Value> valRef) {
  1428. +int SwigV8Packed_Check(v8::Local<v8::Value> valRef) {
  1429. SWIGV8_HANDLESCOPE();
  1430. - v8::Handle<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
  1431. + v8::Local<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
  1432. if(objRef->InternalFieldCount() < 1) return false;
  1433. #if (V8_MAJOR_VERSION-0) < 5
  1434. v8::Handle<v8::Value> flag = objRef->GetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__"));
  1435. @@ -519,13 +542,13 @@ int SwigV8Packed_Check(v8::Handle<v8::Value> valRef) {
  1436. }
  1437. SWIGRUNTIME
  1438. -swig_type_info *SwigV8Packed_UnpackData(v8::Handle<v8::Value> valRef, void *ptr, size_t size) {
  1439. +swig_type_info *SwigV8Packed_UnpackData(v8::Local<v8::Value> valRef, void *ptr, size_t size) {
  1440. if (SwigV8Packed_Check(valRef)) {
  1441. SWIGV8_HANDLESCOPE();
  1442. SwigV8PackedData *sobj;
  1443. - v8::Handle<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
  1444. + v8::Local<v8::Object> objRef = SWIGV8_TO_OBJECT(valRef);
  1445. #if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511)
  1446. v8::Handle<v8::Value> cdataRef = objRef->GetInternalField(0);
  1447. @@ -542,7 +565,7 @@ swig_type_info *SwigV8Packed_UnpackData(v8::Handle<v8::Value> valRef, void *ptr,
  1448. }
  1449. SWIGRUNTIME
  1450. -int SWIGV8_ConvertPacked(v8::Handle<v8::Value> valRef, void *ptr, size_t sz, swig_type_info *ty) {
  1451. +int SWIGV8_ConvertPacked(v8::Local<v8::Value> valRef, void *ptr, size_t sz, swig_type_info *ty) {
  1452. swig_type_info *to = SwigV8Packed_UnpackData(valRef, ptr, sz);
  1453. if (!to) return SWIG_ERROR;
  1454. if (ty) {
  1455. @@ -590,7 +613,7 @@ SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackInfo<SwigV8
  1456. }
  1457. SWIGRUNTIME
  1458. -v8::Handle<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_info *type) {
  1459. +v8::Local<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_info *type) {
  1460. SWIGV8_HANDLESCOPE_ESC();
  1461. SwigV8PackedData *cdata = new SwigV8PackedData(data, size, type);
  1462. @@ -636,8 +659,10 @@ v8::Handle<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_inf
  1463. cdata->handle.MarkIndependent();
  1464. #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
  1465. cdata->handle.MarkIndependent(v8::Isolate::GetCurrent());
  1466. -#else
  1467. +#elif (SWIG_V8_VERSION < 0x0706)
  1468. cdata->handle.MarkIndependent();
  1469. +// Looks like future versions do not require that anymore:
  1470. +// https://monorail-prod.appspot.com/p/chromium/issues/detail?id=923361#c11
  1471. #endif
  1472. SWIGV8_ESCAPE(obj);
  1473. @@ -657,7 +682,7 @@ SWIGRUNTIME
  1474. #if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031903)
  1475. v8::Handle<v8::Value> SWIGV8_AppendOutput(v8::Handle<v8::Value> result, v8::Handle<v8::Value> obj) {
  1476. #else
  1477. -v8::Handle<v8::Value> SWIGV8_AppendOutput(v8::Local<v8::Value> result, v8::Handle<v8::Value> obj) {
  1478. +v8::Local<v8::Value> SWIGV8_AppendOutput(v8::Local<v8::Value> result, v8::Local<v8::Value> obj) {
  1479. #endif
  1480. SWIGV8_HANDLESCOPE_ESC();
  1481. @@ -669,7 +694,12 @@ v8::Handle<v8::Value> SWIGV8_AppendOutput(v8::Local<v8::Value> result, v8::Handl
  1482. #else
  1483. v8::Local<v8::Array> arr = v8::Local<v8::Array>::Cast(result);
  1484. #endif
  1485. +
  1486. +#if (SWIG_V8_VERSION < 0x0706)
  1487. arr->Set(arr->Length(), obj);
  1488. +#else
  1489. + arr->Set(SWIGV8_CURRENT_CONTEXT(), arr->Length(), obj);
  1490. +#endif
  1491. SWIGV8_ESCAPE(arr);
  1492. }
  1493. diff --git a/Lib/javascript/v8/javascriptruntime.swg b/Lib/javascript/v8/javascriptruntime.swg
  1494. index c78e04efbb..773014f2a5 100644
  1495. --- a/Lib/javascript/v8/javascriptruntime.swg
  1496. +++ b/Lib/javascript/v8/javascriptruntime.swg
  1497. @@ -56,6 +56,11 @@
  1498. %insert(runtime) %{
  1499. #include <v8.h>
  1500. +#if defined(V8_MAJOR_VERSION) && defined(V8_MINOR_VERSION)
  1501. +#undef SWIG_V8_VERSION
  1502. +#define SWIG_V8_VERSION (V8_MAJOR_VERSION * 256 + V8_MINOR_VERSION)
  1503. +#endif
  1504. +
  1505. #include <errno.h>
  1506. #include <limits.h>
  1507. #include <stdlib.h>
  1508. diff --git a/Lib/javascript/v8/javascriptstrings.swg b/Lib/javascript/v8/javascriptstrings.swg
  1509. index e767a6d662..61a937fa52 100644
  1510. --- a/Lib/javascript/v8/javascriptstrings.swg
  1511. +++ b/Lib/javascript/v8/javascriptstrings.swg
  1512. @@ -4,10 +4,10 @@
  1513. * ------------------------------------------------------------ */
  1514. %fragment("SWIG_AsCharPtrAndSize", "header", fragment="SWIG_pchar_descriptor") {
  1515. SWIGINTERN int
  1516. -SWIG_AsCharPtrAndSize(v8::Handle<v8::Value> valRef, char** cptr, size_t* psize, int *alloc)
  1517. +SWIG_AsCharPtrAndSize(v8::Local<v8::Value> valRef, char** cptr, size_t* psize, int *alloc)
  1518. {
  1519. if(valRef->IsString()) {
  1520. - v8::Handle<v8::String> js_str = SWIGV8_TO_STRING(valRef);
  1521. + v8::Local<v8::String> js_str = SWIGV8_TO_STRING(valRef);
  1522. size_t len = SWIGV8_UTF8_LENGTH(js_str) + 1;
  1523. char* cstr = new char[len];
  1524. @@ -20,7 +20,7 @@ SWIG_AsCharPtrAndSize(v8::Handle<v8::Value> valRef, char** cptr, size_t* psize,
  1525. return SWIG_OK;
  1526. } else {
  1527. if(valRef->IsObject()) {
  1528. - v8::Handle<v8::Object> obj = SWIGV8_TO_OBJECT(valRef);
  1529. + v8::Local<v8::Object> obj = SWIGV8_TO_OBJECT(valRef);
  1530. // try if the object is a wrapped char[]
  1531. swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
  1532. if (pchar_descriptor) {
  1533. @@ -41,7 +41,7 @@ SWIG_AsCharPtrAndSize(v8::Handle<v8::Value> valRef, char** cptr, size_t* psize,
  1534. }
  1535. %fragment("SWIG_FromCharPtrAndSize","header",fragment="SWIG_pchar_descriptor") {
  1536. -SWIGINTERNINLINE v8::Handle<v8::Value>
  1537. +SWIGINTERNINLINE v8::Local<v8::Value>
  1538. SWIG_FromCharPtrAndSize(const char* carray, size_t size)
  1539. {
  1540. if (carray) {
  1541. @@ -49,7 +49,7 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size)
  1542. // TODO: handle extra long strings
  1543. return SWIGV8_UNDEFINED();
  1544. } else {
  1545. - v8::Handle<v8::String> js_str = SWIGV8_STRING_NEW2(carray, size);
  1546. + v8::Local<v8::String> js_str = SWIGV8_STRING_NEW2(carray, size);
  1547. return js_str;
  1548. }
  1549. } else {
  1550. diff --git a/Lib/javascript/v8/javascripttypemaps.swg b/Lib/javascript/v8/javascripttypemaps.swg
  1551. index 4601698e03..fbe7849cd2 100644
  1552. --- a/Lib/javascript/v8/javascripttypemaps.swg
  1553. +++ b/Lib/javascript/v8/javascripttypemaps.swg
  1554. @@ -25,7 +25,7 @@
  1555. /* Javascript types */
  1556. -#define SWIG_Object v8::Handle<v8::Value>
  1557. +#define SWIG_Object v8::Local<v8::Value>
  1558. #define VOID_Object SWIGV8_UNDEFINED()
  1559. /* Overload of the output/constant/exception/dirout handling */
  1560. diff --git a/Source/Modules/javascript.cxx b/Source/Modules/javascript.cxx
  1561. index d2b33b1b42..450ebbd497 100644
  1562. --- a/Source/Modules/javascript.cxx
  1563. +++ b/Source/Modules/javascript.cxx
  1564. @@ -548,7 +548,7 @@ void JAVASCRIPT::main(int argc, char *argv[]) {
  1565. }
  1566. Swig_mark_arg(i);
  1567. engine = JSEmitter::JavascriptCore;
  1568. - } else if (strcmp(argv[i], "-node") == 0) {
  1569. + } else if ((strcmp(argv[i], "-node") == 0) || (strcmp(argv[i], "-electron") == 0)) {
  1570. if (engine != -1) {
  1571. Printf(stderr, ERR_MSG_ONLY_ONE_ENGINE_PLEASE);
  1572. SWIG_exit(-1);
  1573. @@ -594,7 +594,7 @@ void JAVASCRIPT::main(int argc, char *argv[]) {
  1574. }
  1575. default:
  1576. {
  1577. - Printf(stderr, "SWIG Javascript: Unknown engine. Please specify one of '-jsc', '-v8' or '-node'.\n");
  1578. + Printf(stderr, "SWIG Javascript: Unknown engine. Please specify one of '-jsc', '-v8' or '-node/-electron'.\n");
  1579. SWIG_exit(-1);
  1580. break;
  1581. }
  1582. diff --git a/Tools/javascript/v8_shell.cxx b/Tools/javascript/v8_shell.cxx
  1583. index 5001bc25a6..8067247a41 100644
  1584. --- a/Tools/javascript/v8_shell.cxx
  1585. +++ b/Tools/javascript/v8_shell.cxx
  1586. @@ -9,7 +9,7 @@
  1587. #include "js_shell.h"
  1588. -typedef int (*V8ExtensionInitializer) (v8::Handle<v8::Object> module);
  1589. +typedef int (*V8ExtensionInitializer) (v8::Local<v8::Object> module);
  1590. // Note: these typedefs and defines are used to deal with v8 API changes since version 3.19.00
  1591. @@ -87,7 +87,7 @@ class V8Shell: public JSShell {
  1592. private:
  1593. - v8::Handle<v8::Value> Import(const std::string &moduleName);
  1594. + v8::Local<v8::Value> Import(const std::string &moduleName);
  1595. SwigV8Context CreateShellContext();
  1596. @@ -135,7 +135,7 @@ bool V8Shell::RunScript(const std::string &scriptPath) {
  1597. // Store a pointer to this shell for later use
  1598. - v8::Handle<v8::Object> global = context->Global();
  1599. + v8::Local<v8::Object> global = context->Global();
  1600. v8::Local<v8::External> __shell__ = SWIGV8_EXTERNAL_NEW((void*) (long) this);
  1601. global->SetHiddenValue(SWIGV8_STRING_NEW("__shell__"), __shell__);
  1602. @@ -215,7 +215,7 @@ bool V8Shell::ExecuteScript(const std::string &source, const std::string &name)
  1603. SWIGV8_HANDLESCOPE();
  1604. v8::TryCatch try_catch;
  1605. - v8::Handle<v8::Script> script = v8::Script::Compile(SWIGV8_STRING_NEW(source.c_str()), SWIGV8_STRING_NEW(name.c_str()));
  1606. + v8::Local<v8::Script> script = v8::Script::Compile(SWIGV8_STRING_NEW(source.c_str()), SWIGV8_STRING_NEW(name.c_str()));
  1607. // Stop if script is empty
  1608. if (script.IsEmpty()) {
  1609. @@ -224,7 +224,7 @@ bool V8Shell::ExecuteScript(const std::string &source, const std::string &name)
  1610. return false;
  1611. }
  1612. - v8::Handle<v8::Value> result = script->Run();
  1613. + v8::Local<v8::Value> result = script->Run();
  1614. // Print errors that happened during execution.
  1615. if (try_catch.HasCaught()) {
  1616. @@ -241,7 +241,7 @@ bool V8Shell::DisposeEngine() {
  1617. SwigV8Context V8Shell::CreateShellContext() {
  1618. // Create a template for the global object.
  1619. - v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
  1620. + v8::Local<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
  1621. // Bind global functions
  1622. global->Set(SWIGV8_STRING_NEW("print"), SWIGV8_FUNCTEMPLATE_NEW(V8Shell::Print));
  1623. @@ -258,7 +258,7 @@ SwigV8Context V8Shell::CreateShellContext() {
  1624. #endif
  1625. }
  1626. -v8::Handle<v8::Value> V8Shell::Import(const std::string &module_path)
  1627. +v8::Local<v8::Value> V8Shell::Import(const std::string &module_path)
  1628. {
  1629. SWIGV8_HANDLESCOPE_ESC();
  1630. @@ -319,7 +319,7 @@ SwigV8ReturnValue V8Shell::Require(const SwigV8Arguments &args) {
  1631. v8::Local<v8::External> __shell__ = v8::Local<v8::External>::Cast(hidden);
  1632. V8Shell *_this = (V8Shell *) (long) __shell__->Value();
  1633. - v8::Handle<v8::Value> module = _this->Import(moduleName);
  1634. + v8::Local<v8::Value> module = _this->Import(moduleName);
  1635. SWIGV8_RETURN(module);
  1636. }
  1637. @@ -345,7 +345,7 @@ void V8Shell::ReportException(v8::TryCatch *try_catch) {
  1638. v8::String::Utf8Value exception(try_catch->Exception());
  1639. const char *exception_string = V8Shell::ToCString(exception);
  1640. - v8::Handle<v8::Message> message = try_catch->Message();
  1641. + v8::Local<v8::Message> message = try_catch->Message();
  1642. if (message.IsEmpty()) {
  1643. // V8 didn't provide any extra information about this error; just
  1644. // print the exception.
  1645. diff --git a/Tools/testflags.py b/Tools/testflags.py
  1646. index f3d216b59a..64528d6925 100755
  1647. --- a/Tools/testflags.py
  1648. +++ b/Tools/testflags.py
  1649. @@ -41,7 +41,10 @@ def get_cxxflags(language, std, compiler):
  1650. "go":"-Werror " + cxx_common,
  1651. "guile":"-Werror " + cxx_common,
  1652. "java":"-Werror " + cxx_common,
  1653. - "javascript":"-Werror " + cxx_common + " -Wno-error=unused-function", # Until overload_rename is fixed for node
  1654. + "javascript":"-Werror " + cxx_common +
  1655. + " -Wno-error=unused-function" + # Until overload_rename is fixed for node
  1656. + " -Wno-error=unused-result -Wno-unused-result", # Until proper update of latest NodeJS / V8
  1657. + # " -Wno-error=cast-function-type" + Only in GCC 8.x+
  1658. "lua":"-Werror " + cxx_common,
  1659. "mzscheme":"-Werror " + cxx_common,
  1660. "ocaml":"-Werror " + cxx_common,
  1661. diff --git a/Tools/travis-linux-install.sh b/Tools/travis-linux-install.sh
  1662. index c8347d27a4..04683572af 100755
  1663. --- a/Tools/travis-linux-install.sh
  1664. +++ b/Tools/travis-linux-install.sh
  1665. @@ -33,7 +33,7 @@ case "$SWIGLANG" in
  1666. ;;
  1667. "javascript")
  1668. case "$ENGINE" in
  1669. - "node")
  1670. + "node"|"electron")
  1671. travis_retry wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.10/install.sh | bash
  1672. export NVM_DIR="$HOME/.nvm"
  1673. [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
  1674. @@ -45,6 +45,11 @@ case "$SWIGLANG" in
  1675. else
  1676. travis_retry npm install -g node-gyp
  1677. fi
  1678. +
  1679. + if [ ! -z "$ELECTRON_VER" ] ; then
  1680. + travis_retry npm install -g electron@$ELECTRON_VER
  1681. + fi
  1682. +
  1683. ;;
  1684. "jsc")
  1685. travis_retry sudo apt-get install -qq libwebkitgtk-dev