0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-11-08 18:58:41 +00:00
Commit Graph

87 Commits

Author SHA1 Message Date
Jan-E
672d6952fd make it compile with PHP 7.4 on Windows 2020-04-05 06:24:58 +02:00
Timothy Pace
3955409f56 Remove deprecated Context versions of ToBoolean and BooleanValue 2020-02-13 16:42:40 -08:00
Christiano Becker
d36aa6c9d5 Update v8js_methods.cc
* require() method: check when Module Loader returns an array (ex: require on a .json file) and map to array to JavaScript
2018-12-03 11:30:22 -02:00
Stefan Siegl
9c45508183
omit use of deprecated apis 2018-09-13 14:01:15 +02:00
Stefan Siegl
ab6e2267af
adapt mandatory api changes for V8 7.0.276.3, refs #374 2018-09-12 15:43:48 +02:00
Stefan Siegl
313ad1e258
cleanup: remove no longer needed modules_base from ctx, refs #349 2018-02-01 19:43:36 +01:00
Stefan Siegl
48a763d6db
pass module_base directly via FunctionTemplate, closes #349 2018-02-01 19:39:26 +01:00
Stefan Siegl
7663fb6888
support native modules 2018-01-05 21:44:40 +01:00
Stefan Siegl
b12a2fb4e3
Merge remote-tracking branch 'stesie/require-exception-handling' into php7 2017-11-26 12:24:46 +01:00
Stefan Siegl
1c7e355937
allow modules to return arbitrary values 2017-11-12 16:26:18 +01:00
Stefan Siegl
384ec9b1b6
use "this = module.exports" for modules 2017-11-12 16:20:24 +01:00
Stefan Siegl
f3a46ff833
re-use global context for modules + provide module.exports 2017-11-12 16:14:32 +01:00
Stefan Siegl
096454fdf4
Fix deprecated API calls 2017-04-23 22:50:00 +02:00
Stefan Siegl
745126b5cb remove left-over TSRM stuff 2017-03-11 13:45:23 +01:00
Stefan Siegl
3e8ef5f684 remove V8JS_TSRMLS_FETCH 2017-03-11 13:43:30 +01:00
Stefan Siegl
24bb1761bf remove TSRMLS_DC, TSRMLS_CC 2017-03-11 13:35:21 +01:00
Stefan Siegl
d97832d9fb v8::Handle -> v8::Local 2017-03-11 13:31:40 +01:00
Stefan Siegl
288fe4d2a0 PHP Version 5 -> 7 2017-03-11 12:33:49 +01:00
Stefan Siegl
3761657335 update copyright years of changed files 2017-03-11 10:17:10 +01:00
Stefan Siegl
7625d9b94f v8js_methods: add size checks + precission down casts 2017-03-10 23:08:42 +01:00
Stefan Siegl
5ae48bbda7 Fix refcounting, use zval_ptr_dtor, closes #250 2016-08-12 01:02:56 +02:00
Stefan Siegl
9fd201eb16 forward exceptions thrown in module normaliser 2016-07-03 22:57:11 +02:00
Stefan Siegl
7dcebdd927 forward exceptions thrown in module loader 2016-07-03 22:52:50 +02:00
Stefan Siegl
c459acd1ef Merge remote-tracking branch 'origin/master' into php7 2016-07-02 22:59:33 +02:00
Stefan Siegl
3278be8bee Add 'indent-tabs-mode: t' to file variables 2016-07-02 22:48:45 +02:00
Stefan Siegl
2e5a565237 Remove (meanwhile) unreferenced local variables 2016-05-26 21:53:17 +02:00
Stefan Siegl
e9e90bac65 Merge remote-tracking branch 'origin/master' into php7
Conflicts:
      config.w32
      package.xml
      php_v8js_macros.h
      v8js.cc
      v8js_array_access.cc
      v8js_class.cc
      v8js_convert.cc
      v8js_exceptions.cc
      v8js_object_export.cc
      v8js_timer.cc
      v8js_v8.cc
      v8js_v8object_class.cc
2016-05-22 22:30:19 +02:00
Stefan Siegl
b21ba328d0 Don't call ObjectTemplate.Set with Object instances, fixes #230
This works fine with V8 < 5.2.50 somehow, but is now (properly) detected
and causing V8 to bail out.  Fixed by always setting templates on
other templates and finally use Global-Proxy on context to get the
actually created object instances.
2016-05-22 13:27:48 +02:00
Stefan Siegl
c804b16e4c fix compiler warnings 2016-03-26 12:11:11 +01:00
Stefan Siegl
2d9c831eeb Move zend_try block into v8::Unlocker block
If the v8::Unlocker block is within the zend_try block, then
v8::~Unlocker (dtor) is not called and hence V8 doesn't
re-aquire the lock.

Besides before we re-entered the isolate within zend_try
and hence *before* taking the lock.
2015-12-31 23:42:01 +01:00
Stefan Siegl
2d34adb91f Merge remote-tracking branch 'origin/master'
This primarily ports features introduced with V8Js 0.4.0
to the PHP7 branch.
2015-12-31 20:25:24 +01:00
Stefan Siegl
3108d3947d Fix output of var_dump on regexp (V8 > 4.8)
Newer V8 versions' toString() converts RegExp objects
just to [object RegExp] (instead of the actual regexp
as before).  Work-around by calling GetSource() on the
regexp and create former outhway that way.
2015-12-30 14:59:37 +01:00
Stefan Siegl
67a9de01bd Allow custom module normalisation 2015-12-06 13:55:13 +01:00
Stefan Siegl
f258980399 Accept empty string as module source
This might be perfectly valid, if you're using a third-party module,
which requires a module yet doesn't use it in the code paths hit
and hence you just want to stub it out.
2015-12-06 13:25:43 +01:00
Stefan Siegl
4853c6d17f Set script identifier as String, not Symbol
Otherwise long module identifiers might get cut off.
2015-12-06 13:23:14 +01:00
Stefan Siegl
bf58fe67c1 wrap module loading in zend_try/zend_catch, closes #178 2015-12-04 22:09:04 +01:00
Stefan Siegl
39fff2301e Use module id as JsFileName for V8
This way the information to V8JsScriptException instances are way
more clear since they contain the name of the module that caused
the exception.
2015-12-04 21:46:54 +01:00
Stefan Siegl
2f0b8e2873 Make var_dump command available to modules as well 2015-12-04 21:37:51 +01:00
Stefan Siegl
227ad57163 prefer V8JS_ZSTR over V8JS_STRL(Z_STRVAL), refs #180 2015-12-04 20:14:47 +01:00
Stefan Siegl
059e0500fb Merge remote-tracking branch 'origin/master' into php7 2015-11-29 12:21:40 +01:00
Stefan Siegl
670554306a Fix tests/var_dump.phpt
Recent V8 versions (e.g. 4.8.253 or 4.9.19) consider
`IsFunction() = true` for Closure objects from PHP; but earlier
versions didn't.

This ensures consistent var_dump behaviour (sticking to the
behaviour with older V8 versions).
2015-11-28 15:27:35 +01:00
Stefan Siegl
5cba44ccd0 Merge remote-tracking branch 'origin/master' into php7
Conflicts:
	README.md
	v8js.cc
	v8js_class.cc
	v8js_exceptions.cc
	v8js_object_export.cc
	v8js_v8.cc
	v8js_v8object_class.cc
2015-10-11 02:09:59 +02:00
Stefan Siegl
909e3f004d Adapt to PHP7: v8js_convert.cc, v8js_exception.cc, v8js_methods.cc 2015-08-28 21:05:16 +02:00
Stefan Siegl
8389e126b5 adapt to changed ZVAL_STRING/ZVAL_STRINGL/RETVAL_STRINGL macros 2015-08-23 21:14:49 +02:00
Stefan Siegl
187b97060f Stop JS execution on PHP exceptions, refs #144 2015-08-21 15:55:52 +02:00
Stefan Siegl
cedcac1318 skip useless estrdup/efree cycle
The garbage collector cannot free the object as it is allocated
on the local stack.
2015-08-01 19:45:21 +02:00
Stefan Siegl
2ce7e420a7 Fix use-after-free on module reuse 2015-08-01 18:11:39 +02:00
Stefan Siegl
3d89f0250d Provide key compare function for modules_loaded
Without the compare function std::map simply compares one
pointer to another.  However we need to compare the actual
strings.

Besides we must not efree normalised_module_id on return
of require method, since the pointer was added to
modules_loaded (and is valid until destruction of V8Js
class); instead it is now freed during V8Js object destruction.
2015-08-01 17:49:11 +02:00
Stefan Siegl
754d398ec9 Move v8js_commonjs.cc forward declarations in .h file 2015-08-01 17:09:48 +02:00
Stefan Siegl
72cb2da9ba Enter endless loop after V8::TerminateExecution call, fixes #135
The V8::TerminateExecution does *not* immediately terminate execution
as its name might suggest.  It just marks the given isolate as
"to terminate" and the execution thread checks - from time to time -
whether to terminate.  For v8 itself this is not problematic as
the call is thought to stop long-running scripts executed in the
browser context.

As v8js exposes this function to JavaScript with the exit() method,
this behaviour is confusing.  In order to stop code execution right
at the exit() call, v8js enters an endless loop and waits for v8
to terminate execution within it.
2015-07-25 17:42:32 +02:00