0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-09-21 02:55:17 +00:00
Commit Graph

243 Commits

Author SHA1 Message Date
Stefan Siegl
9d3ff2868c Remove hard-coded pathname from test 2016-08-12 01:11:51 +02:00
Stefan Siegl
5ae48bbda7 Fix refcounting, use zval_ptr_dtor, closes #250 2016-08-12 01:02:56 +02:00
Stefan Siegl
8126fc4928 Handle Z_TYPE == IS_REFERENCE well, fixes #246 2016-08-11 18:54:38 +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
802cdd350a Drop tests/magic_func.phpt which got flaky
Most recent PHP7.0 versions implicitly call __isset before __get, which
older ones don't.

The test needs some major refactoring, after all the file is huge
and better split into smaller pieces.
2016-05-22 23:28:02 +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
3d5f163899 skip time/memory limit tests on SKIP_SLOW_TESTS 2016-03-26 11:47:58 +01:00
Stefan Siegl
b0f761ae3b Merge pull request #221 from stesie/fluent-setters-js
Retain object identity on JS-side 'return this'
2016-03-25 23:20:16 +01:00
Stefan Siegl
93b1118fe8 Retain object identity on JS-side 'return this' 2016-03-25 22:15:05 +01:00
Stefan Siegl
d44592910d Retain object indentity on 'return $this' 2016-03-25 19:15:25 +01:00
Stefan Siegl
d6394301b2 Pass back V8Object instances, don't re-wrap 2016-03-25 17:40:43 +01:00
Stefan Siegl
12903ca269 add V8Js::setAverageObjectSize method 2016-03-08 09:28:16 +01:00
Stefan Siegl
bf6effba63 Merge remote-tracking branch 'origin/master' into php7 2016-03-05 22:21:42 +01:00
Stefan Siegl
87b29749b9 Merge pull request #207 from stesie/custom-snapshots
Handle V8 heap snapshots well + allow custom snapshot generation
2016-03-05 19:27:40 +01:00
Stefan Siegl
67269ddfc4 Adapt test expectations to V8 error message changes
V8 5.1 uses slightly changed SyntaxError messages.
This adapts our tests as needed (for support of V8 5.1 as well
as older versions)
2016-03-05 17:11:52 +01:00
Stefan Siegl
4df6e80be9 Add testcase on V8Js::createSnapshot 2016-03-05 14:12:19 +01:00
Stefan Siegl
3808f69dea Adapt tests V8 3.24 also 2016-01-09 21:45:10 +01:00
Stefan Siegl
796ae85cb6 Adapt tests to different V8 versions 2016-01-09 21:36:30 +01:00
Stefan Siegl
4a8a8b812f Add test that V8Js::__sleep and V8Js::__wakeup are final 2016-01-09 19:15:12 +01:00
Stefan Siegl
d438624a3d Don't export V8Js methods even if overwritten 2016-01-09 19:11:30 +01:00
Stefan Siegl
1e86e2c9f7 Don't export methods of V8Js object to V8 2016-01-09 19:02:58 +01:00
Stefan Siegl
e2636b2e71 Skip Generator export tests if not supported 2016-01-09 14:24:49 +01:00
Stefan Siegl
dbe29d7e96 Add more tests on exported (PHP) Generator objects 2016-01-09 13:19:23 +01:00
Stefan Siegl
a18ae9e853 Implement JS-side wrapper around PHP Generator objects 2016-01-09 12:50:40 +01:00
Stefan Siegl
e0f990bfa1 Add test with private/protected methods, refs #183 2016-01-08 15:47:24 +01:00
Stefan Siegl
38b9c053a1 Enable V8Generator support on V8 >= 3.30.0 2016-01-08 00:12:06 +01:00
Stefan Siegl
a4b4934361 Relax EXPECTF, some V8 versions fail to provide the error location 2016-01-08 00:00:12 +01:00
Stefan Siegl
c500d0c21e Add test on property passing on generators 2016-01-07 23:19:31 +01:00
Stefan Siegl
798a87e481 Add test on fatal errors within JS generators 2016-01-07 23:16:59 +01:00
Stefan Siegl
46fba810af Add test on PHP exceptions thrown by JS generators 2016-01-07 23:15:13 +01:00
Stefan Siegl
479d14b5b0 Handle exceptions thrown in JS generators well 2016-01-07 23:12:43 +01:00
Stefan Siegl
6fa6f9316e Test yield from JS generators 2016-01-07 23:00:45 +01:00
Stefan Siegl
f97a25b69c Test & implement PHP-side instantiation of JS generators 2016-01-07 22:57:50 +01:00
Stefan Siegl
da64b9f055 Handle rewind on primed V8Generator 2016-01-07 22:48:01 +01:00
Stefan Siegl
e686603b89 Implement direct iteration on JS generators 2016-01-07 22:41:13 +01:00
Stefan Siegl
2c7a7ab87d Implement PHP-side iteration of JS generator objects 2016-01-07 21:35:44 +01:00
Stefan Siegl
ef779d8250 minimalist V8 -> PHP generator passing 2016-01-07 20:41:40 +01:00
Stefan Siegl
0945749e7c add basic test on issue #183 2016-01-07 13:44:40 +01:00
Stefan Siegl
adb8288061 Make set_time_limit tests slower
... to reduce the risk of false positives on slower (or busier) boxes.
2016-01-06 17:23:22 +01:00
Stefan Siegl
1d1b87bda3 skip extensions_error.phpt on Windows 2016-01-06 13:26:55 +00:00
Stefan Siegl
c2a2cc341f Initialize libv8_platform for Windows as well
V8 doesn't work without libplatform anymore, even under
Windows.

Furthermore adapted two tests to \r\n vs. \n line
ending differences
2016-01-06 11:58:40 +00:00
Stefan Siegl
362eb0b806 Merge pull request #190 from stesie/warn-only-on-v8-errors
Don't abort PHP on fatal V8 errors, just warn about it
2015-12-31 21:42:00 +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
de23e8dba4 Don't abort PHP on fatal V8 errors, just warn about it
This way the PHP script can handle V8 errors gracefully
(and e.g. provide feedback to the user).

This especially changes behaviour when circular extension
dependencies happen (PHP code can go on, just V8 fails
to start).  This also fixes memory leaks of V8 and V8Js
itself caused by bailing out directly otherwise.
2015-12-30 17:53:46 +01:00
Stefan Siegl
3c5508b956 Provide correct "this" on V8Object method invocation, closes #185 2015-12-26 12:16:17 +01:00
Stefan Siegl
67a9de01bd Allow custom module normalisation 2015-12-06 13:55:13 +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
97a9a2cc74 tests/pthreads_001: don't test pthread ext internals 2015-12-04 19:22:29 +01:00
Stefan Siegl
059e0500fb Merge remote-tracking branch 'origin/master' into php7 2015-11-29 12:21:40 +01:00
Matt Kynaston
a58f944804 Experiment to see if #172 is easy to fix 2015-11-03 17:35:30 +00:00
Stefan Siegl
296b9078ff fix exception back-propagation on PHP7 2015-10-11 14:59:25 +02: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
b8726409f4 Throw V8JsException if v8 context cannot be created
We used to reset This to NULL, which never reallt was supposed to work
and PHP doc explicitly tell to not touch EX(This)
2015-10-03 00:01:12 +02:00
Stefan Siegl
afa52c07bc Remove hard-coded full pathnames from test 2015-10-02 22:29:27 +02:00
Stefan Siegl
cbbce91ffd Rename constructor functions to __construct 2015-09-28 22:56:22 +02:00
Stefan Siegl
7d97c97d4c Fix multi-threading, initialize V8 only once 2015-09-26 18:58:12 +02:00
Stefan Siegl
83f51e5021 Merge pull request #156 from stesie/php-exception-behaviour
PHP->JS exception propagation
2015-09-23 19:40:23 +02:00
Stefan Siegl
8934db6dec Add v8js.compat_php_exceptions INI switch 2015-09-23 19:19:11 +02:00
Stefan Siegl
11155a6a51 PHP7 adapt: changed fatal error messages 2015-08-29 21:21:43 +02:00
Stefan Siegl
49acfc6f22 Adapt ctx_lifetime test to PHP7: changed exception handling 2015-08-29 20:19:22 +02:00
Stefan Siegl
53995ac616 Make FLAG_FORCE_ARRAY not affect V8Function objects, #closes 160 2015-08-26 18:41:38 +02:00
Stefan Siegl
790735f04a Fix tests/php_exceptions_005.phpt 2015-08-23 19:30:47 +02:00
Stefan Siegl
c033000aea Fix tests/exception_propagation_2.phpt
The test relied on weird behaviour that PHP exceptions shouldn't stop
JavaScript code execution.  Since JavaScript execution is now stopped,
the JavaScript catch handler is not executed anymore.
2015-08-23 18:05:46 +02:00
Stefan Siegl
b7dde1b1db Handle thrown PHP objects, that are no exceptions 2015-08-23 17:40:27 +02:00
Stefan Siegl
f7c33539c2 Improve PHP->JS->PHP exception back propagation 2015-08-23 15:09:21 +02:00
Stefan Siegl
462eb623b3 Allow PHP exception to JS propagation 2015-08-22 15:16:02 +02:00
Stefan Siegl
187b97060f Stop JS execution on PHP exceptions, refs #144 2015-08-21 15:55:52 +02:00
Stefan Siegl
829bac9ddc Merge pull request #150 from stesie/issue-140
Fix module caching & memory leaks
2015-08-03 08:40:26 +02:00
Stefan Siegl
441f7b7fab v8js_commonjs_split_terms: use pointer comparison instead of strlen
The strlen usage on term obviously was wrong here, since the term
string is not null-terminated at that place.
2015-08-01 19:54:23 +02:00
Stefan Siegl
ea3ec4bd65 Fix commonjs memory leaks (and increase test coverage to 100%) 2015-08-01 19:30:55 +02:00
Stefan Siegl
3324490a79 test issue_127_001.phpt doesn't depend on ext_json 2015-08-01 18:47:44 +02:00
Stefan Siegl
d8e239a756 test per isolate module cache seperation 2015-08-01 17:57:57 +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
34242c5d60 skip extensions_error test for v8 version < 3.30 2015-07-25 18:16:04 +02:00
Stefan Siegl
81018372e4 Adapt test to changed v8 error message
Added a "%s" so both messages are matched:

 * Extension or internal compilation error: MakeReferenceError in handlebars at line 1.
 * Extension or internal compilation error in handlebars at line 1.
2015-07-25 16:01:54 +02:00
Stefan Siegl
e67f1f4c9c Fix handling of failed context creation, closes #136 2015-05-01 11:43:24 +02:00
Stefan Siegl
b350871795 Correctly force to array on property writing, closes #137 2015-04-26 13:49:13 +02:00
Stefan Siegl
af58f4ec9e Catch serialization of V8Function instances 2014-12-11 22:28:01 +01:00
Stefan Siegl
73d022cca1 Test unserialization with properties 2014-12-11 22:15:38 +01:00
Stefan Siegl
c0d1e2fa6d Catch serialization of V8Object instances 2014-12-11 20:58:53 +01:00
Stefan Siegl
1386c96d26 Catch serialization of V8Js object, closes #119 2014-12-11 19:30:06 +01:00
Stefan Siegl
0ea210f94e Throw V8JsException if source is not a script 2014-12-11 18:05:37 +01:00
Stefan Siegl
c28c9f50f1 introduce V8JsException class 2014-12-11 18:00:43 +01:00
Stefan Siegl
2b4750748e Merge branch 'array-access'
Conflicts:
	v8js_convert.cc
2014-12-10 20:02:33 +01:00
Stefan Siegl
a7fbe9dde4 Fix path seperator for Windows 2014-12-10 19:46:15 +01:00
Stefan Siegl
8b89a7b691 increase time limit to start engine 2014-12-10 19:27:04 +01:00
Stefan Siegl
1613570ced Add test on die() call, refs #122 2014-12-10 01:10:30 +01:00
Simon Best
dbea6fc122 Correct name of memory limit test. 2014-12-09 22:53:06 +01:00
Stefan Siegl
7ac12c4fbd Unwind stack after fatal error in V8Function, closes #130 2014-12-09 22:40:53 +01:00
Stefan Siegl
2252169a98 Use isolate->RequestInterrupt to get heap size 2014-12-09 01:08:16 +01:00
Stefan Siegl
0004626015 Make time limit tests pass more safely 2014-12-09 01:06:46 +01:00
Stefan Siegl
b6fb9acc65 Remove set_memory_limit_002 test
The test is unfortunately unstable as it somehow depends on CPU speed.
v8 seems to precompute the result even so it hasn't reached the for
loop consuming the memory.

This can be proved easily by adding a sleep(1) call at the start of the
prolongTimeLimit function.  Then the memory limit is always tripped
even so v8 didn't have to do much until there
2014-12-07 16:52:10 +01:00
Stefan Siegl
e85b095282 Add test showing that time limits can be prolonged 2014-12-07 16:44:54 +01:00
Stefan Siegl
c17208c9c0 Allow to impose memory & time limits 2014-12-07 16:44:54 +01:00
Stefan Siegl
8945357d76 Allow to change & reset memory limits 2014-12-07 16:44:52 +01:00
Stefan Siegl
daf8788e0f Allow to change & reset time limits 2014-12-07 16:05:58 +01:00
Stefan Siegl
2a1ae43496 Use prologues for V8Function calls, closes #129 2014-12-07 15:19:47 +01:00
Stefan Siegl
3a1f3e5237 Add setMemoryLimit & setTimeLimit setter methods 2014-12-07 13:25:52 +01:00