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
Stefan Siegl
5b4aaa64f1
More php_v8js_ prefix cleanup
2014-12-13 01:37:25 +01:00
Stefan Siegl
2954de2db5
Remove php_ prefix to struct & type names
2014-12-13 01:18:42 +01:00
Stefan Siegl
3efec8d428
Remove CVS $Id$ comment lines
2014-12-13 00:45:05 +01:00
Stefan Siegl
c339d51924
Drop old-age PHP_V8_API_VERSION #ifdef
2014-10-19 12:20:10 +00:00
Stefan Siegl
f6310f9994
Get rid of V8JS_NEW macro.
2014-10-19 11:58:21 +00:00
Stefan Siegl
eda74908cc
Fix module caching, closes #107
...
Use v8::Persistent handle to keep module instances around.
Objects cannot be shared between isolates anyhow, hence moved
modules_loaded map from global V8JSG structure to php_v8js_ctx.
Besides fixes a use-after-free on normalised_module_id.
2014-09-19 22:36:27 +00:00
Stefan Siegl
a134129018
Use isolate version of V8::TerminateExecution, refs #92
2014-05-14 23:39:41 +02:00
Stefan Siegl
c54b49d2a6
Use PHPWRITE macro instead of php_output_write, refs #80
...
php_output_write is not available in PHP 5.3.
2014-03-23 00:54:15 +01:00
Stefan Siegl
fd801631b7
Add null-byte passing test, make var_dump null-byte safe, closes #80
2014-03-23 00:28:53 +01:00
Stefan Siegl
1186e7951f
Make compatible with V8 3.25.12, fixes #88
2014-03-22 17:58:38 +01:00
Stefan Siegl
4c64bc4ad9
Make compatible with V8 3.24.10, fixes #83
2014-03-22 00:07:53 +01:00
Stefan Siegl
8858bf5f27
Make compatible with V8 3.23.2 (and below)
2013-12-21 20:54:55 +01:00
Stefan Siegl
69290b5779
Fix build against libv8 3.24.5
2013-12-21 01:18:08 +01:00
C. Scott Ananian
b4d560dd52
Fix a bunch of memory leaks.
...
Found by compiling PHP with --enable-debug.
2013-10-26 23:14:39 -04:00
C. Scott Ananian
39cc821f91
Store tsrm_ls in php_v8js_ctx.
...
This avoids the need to ever do a (slow) TSRMLS_FETCH().
2013-10-26 02:07:12 -04:00
C. Scott Ananian
52d8946b89
Add isolate parameter to V8JS_* macros.
...
This avoids unnecessary calls to Isolate::GetCurrent() in the implementation.
By standardizing on the V8JS_SYM and V8JS_STR macros we also standardize on
UTF-8 encoding for v8 strings.
2013-10-25 16:46:07 -04:00
C. Scott Ananian
27a140c9fb
Bug fixes for JavaScript var_dump implementation (make it match PHP).
2013-10-25 14:18:56 -04:00
C. Scott Ananian
c725a80674
Handle NULL in global.var_dump().
2013-10-25 14:18:56 -04:00
C. Scott Ananian
49632054a4
Cleanup: remove some warnings when compiled with -Wunused
2013-10-25 14:17:40 -04:00
Stefan Siegl
61eee4cbd6
TSRM/ZTS fixes.
2013-10-19 23:04:35 +00:00
Stefan Siegl
619231913c
Adapt to new v8::Persistent API, support V8 >= 3.21.12
2013-10-03 16:27:04 +02:00
Patrick Reilly
dc1475a3ad
updated package for beta release and switch license to MIT
2013-09-28 10:17:33 -07:00
Stefan Siegl
ffa42cdfaf
Replaced deprecated v8 api calls with newer equivalents
2013-07-08 00:58:19 +02:00
Stefan Siegl
6eeb6fe9d6
Use v8::Isolate version of v8::Context::New
2013-07-07 22:36:56 +02:00
Patrick Reilly
98638c78db
fix for format '%d' expects argument of type 'int', but argument 2 has type 'size_t {aka long unsigned int}' [-Wformat]
2013-05-16 16:59:41 -07:00
Simon Best
8ae7606338
Refactor CommonJS modules functionality to store state in the extension globals and context as appropriate.
2013-04-13 00:00:27 +01:00
Simon Best
be0cd75c65
Improve compatibility with NodeJS-style module.exports and exports. This allows arbitrary types to be exported, not just properties of the exports object.
2013-03-26 00:09:21 +00:00
Simon Best
99878e2995
Support for relative and absolute module identifiers.
2013-03-25 00:02:13 +00:00
Simon Best
db50fc25d1
Removed spurious number from exception message.
2013-03-24 22:56:55 +00:00
Simon Best
cd20140774
Handle exceptions throw from module loader callback.
2013-03-24 22:53:31 +00:00
Simon Best
ff34a2ddda
Normalisation of module identifier.
2013-03-24 22:27:46 +00:00
Simon Best
114eb9cbf6
Removed spurious line.
2013-03-24 20:43:51 +00:00
Simon Best
ff443f3bc7
Check for module cyclic dependencies. Throw proper V8 exceptions when the require method is not successful.
2013-03-24 19:08:54 +00:00
Simon Best
84baa7614a
First working version of CommonJS modules.
2013-03-24 16:27:13 +00:00
Patrick Reilly
dfbd5f0c0c
Fixed build in 5.4+
2012-07-06 17:12:53 -07:00
Patrick Reilly
7593cbcc59
Update copyright information
2012-04-27 16:41:32 +00:00
preilly
30e1d22863
Initial import
2012-04-27 16:26:15 +00:00