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
Stefan Siegl
0023c03280
Use v8::TryCatch if calling V8Function, refs #127
2014-12-01 22:12:22 +01:00
Stefan Siegl
901268994a
Implement isset behaviour on ArrayAccess objects
2014-11-30 22:43:56 +01:00
Stefan Siegl
1b027a525f
Implement delete behaviour on ArrayAccess objects
2014-11-30 22:31:27 +01:00
Stefan Siegl
6399b49b3f
Improve ArrayAccess enumeration
...
When enumerating an ArrayAccess-style object the array keys should be
returned, not the method names & properties of the PHP object.
2014-11-30 21:00:42 +01:00
Stefan Siegl
35350f7642
Test __invoke handling on ArrayAccess objects
2014-11-29 21:34:17 +01:00
Stefan Siegl
d21896ab33
Test export of properties on ArrayAccess object
...
Private & protected properties shouldn't be accessible, also the
length property should not be overwritten by a length property of
the PHP object.
2014-11-29 21:30:44 +01:00
Stefan Siegl
5a11ef2468
Test ArrayAccess prototype method overwriting
...
If the PHP object implementing ArrayAccess has a method,
that has the same name as one of the Array.prototype methods,
the PHP method shall be called, i.e. overwrite the JS method.
2014-11-29 21:28:21 +01:00
Stefan Siegl
b25960786d
Remove count() echo statements
...
These cause the test to fail on old v8 versions like 3.24.10
since the Array.prototype.push implementation calls count() twice
with that version (causing a second echo-line that makes the
test fail).
2014-11-29 20:23:23 +00:00
Stefan Siegl
2b897e8bc4
Export extra methods on ArrayAccess
...
This merges the distinct code path for the export of ArrayAccess
capable PHP objects back into the "common" PHP object export code.
Sole difference is that the ArrayAccess-style object has index
property handlers as well as property bridging to Array.prototype.
2014-11-29 20:35:32 +01:00
Stefan Siegl
5135afa67e
Add ArrayAccess test with native JS push method
2014-11-29 13:41:35 +01:00
Stefan Siegl
1b64a92c8d
Add test on ArrayAccess live binding
2014-11-29 13:25:01 +01:00
Stefan Siegl
1efd91b29a
Add array access offsetSet support
2014-11-25 23:43:21 +01:00
Stefan Siegl
66b42ce080
Add slice call to array_access test
2014-11-25 21:18:00 +01:00
Stefan Siegl
3f6ea8fcfd
Set Array.prototype on ArrayAccess wrapped object
2014-11-23 23:47:29 +01:00
Stefan Siegl
f1dd5ad23b
Add basic ArrayAccess wrapping
2014-11-23 23:39:15 +01:00
Stefan Siegl
6d43ec6dbc
Fix exception_clearing test wrt. column numbers
2014-11-22 18:58:05 +01:00
Stefan Siegl
654a8b8039
Merge branch 'issue-126'
2014-11-22 13:27:26 +01:00
Stefan Siegl
65148db31f
Add StartColumn/EndColumn properties to script exception, closes #126
2014-11-22 12:56:00 +01:00
Stefan Siegl
3ec580aaa3
Add test on clearPendingException
2014-11-22 02:18:32 +01:00
Stefan Siegl
7b435e30dc
Skip tests/timezones on Windows
2014-11-16 23:07:32 +01:00
Stefan Siegl
cd44e72683
Slow down memory_limit test
...
Otherwise the test may execute so fast, that the
watchdog thread, ticking at 10ms currently, is too
slow to detect the memory limit situation.
2014-11-16 20:20:43 +01:00
Stefan Siegl
4e0b500de0
Use directory seperator pattern %e
2014-11-13 21:26:47 +01:00
Stefan Siegl
249aa39418
object_dom test requires DomDocument class
2014-11-13 21:24:22 +01:00
Stefan Siegl
293ca476f0
commonjs_modules test requires json_encode.
2014-11-13 21:14:05 +01:00
Stefan Siegl
8d8aed1e72
Reject V8Function passback to wrong isolate, closes #116
2014-10-31 23:35:28 +00:00
Stefan Siegl
3145ea0323
Set hidden data also on already know weak objects, closes #121
2014-10-30 22:02:13 +00:00
Stefan Siegl
fb4ada80a3
Merge branch 'testcov-php_v8js_v8_write_property'
2014-10-19 18:02:30 +00:00
Stefan Siegl
edc62b5d7d
Merge branch 'testcov-php_v8js_v8_unset_property'
2014-10-19 18:02:23 +00:00
Stefan Siegl
a2604e2749
Add test on php_v8js_v8_unset_property.
2014-10-19 15:15:20 +00:00
Stefan Siegl
f8fc35d4c6
Add test on php_v8js_v8_write_property.
2014-10-19 15:03:29 +00:00
Stefan Siegl
492f87cd5b
Test exception branch of php_v8js_v8_has_property.
2014-10-19 14:48:11 +00:00
Stefan Siegl
16af153c3e
Merge branch 'cscott/issue-64' (ctx_lifecycle test).
...
Test adapted to current behaviour of V8Js, that the situation is
properly handled, but not by keeping objects valid, but by
invalidating all of them.
2014-10-18 20:28:06 +00:00
Stefan Siegl
5a78a76d41
Adapt unwind tests for PHP 5.6 style error messages
...
PHP 5.6 has more detailed error messages, i.e. it says
"on null" instead of "on a non-object". Replaced this
particular part by a %s match to match both possibilities
so the test suite passes on PHP 5.6 as well as older
versions.
2014-09-21 20:34:10 +00:00
Stefan Siegl
edb4679223
Adapt var_dump test new php versions.
...
Newer versions of PHP in 5.4 and 5.5 line add micro seconds
precision to datetime representations.
This adds a regular expression to ignore the .000000 suffix.
2014-09-21 19:49:24 +00:00
Stefan Siegl
c91f96a439
Merge pull request #108 from stesie/fix-commonjs-module-reuse
...
Fix module caching, closes #107
2014-09-20 15:05:31 +02: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
Taneli Leppa
7310c93c1e
Deprecate V8Js::checkString() in favour of compileString() and add tests.
2014-09-16 17:10:15 +03:00
Taneli Leppa
bd7d649d90
Added new functions V8Js::compileString() and V8Js::executeScript().
...
Conflicts:
php_v8js_macros.h
2014-09-16 17:09:58 +03:00
Stefan Siegl
ebcb6dc211
Keep track of V8Object/V8Function instances
...
Disallow access to these once the V8Js object has been destroyed.
2014-08-11 03:11:02 +02:00
Stefan Siegl
50fdfc5c88
Add test on constructor get-accessor.
2014-08-10 13:53:10 +02:00
Stefan Siegl
1d8ae1f458
Test whether error handler is removed correctly, if outermost frame is left
2014-05-23 00:45:08 +02:00
Stefan Siegl
1fc79f8223
Don't restore original error handler when exiting inner frame, refs #94
2014-05-23 00:35:51 +02:00
Stefan Siegl
464cff0477
test unwind behaviour on PHP notices & warnings, refs #94
2014-05-23 00:03:42 +02:00
Stefan Siegl
6f31840daf
Handle fatal errors even if executeString is used recursively
2014-04-13 22:52:38 +02:00
Stefan Siegl
35d8b815f8
Store error message and re-throw with original type & message
2014-04-13 21:46:31 +02:00
Stefan Siegl
956eacb180
Add test on property visibility regarding hasOwnProperty
2014-04-11 20:50:36 +02:00
Stefan Siegl
48feb0bf35
Don't unset non-public properties, just hide them.
...
Before non-public properties were not reset also, trying to
unset them just caused a fatal php error, effectively crashing
the whole script.
2014-04-11 20:42:55 +02:00
Stefan Siegl
aa924a8cb3
Add test on visibility of properties on enumeration
2014-04-11 19:04:05 +02:00
Stefan Siegl
8f200b3905
Call __set if JS accesses private/protected property
2014-04-07 00:53:46 +02:00
Stefan Siegl
53cac1c524
Don't allow JS to overwrite protected/private properties
2014-04-06 23:53:08 +02:00
Stefan Siegl
170b1ff94c
Handle property visibility and __get, refs #79
...
Protected and private properties should not be available
to JS context. Instead call __get function, if the
property is not accessible.
2014-04-06 20:04:48 +02:00
Stefan Siegl
a7d5a0776c
Make datetime_pass.phpt run on PHP 5.3, refs #86
2014-03-23 00:39:45 +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
ddbef50ea6
Merge remote-tracking branch 'rosmo/master'
2014-03-22 18:44:13 +01:00
Stefan Siegl
bc86ce9e44
Clear persistent cells with weak references correctly, refs #88
2014-03-22 17:41:00 +01:00
Taneli Leppa
da53c90f88
Added new "v8js.use_date" ini setting to convert PHP DateTime objects to Javascript Date objects
...
when set as V8JS object properties.
2014-03-20 16:06:18 +02:00
Taneli Leppa
66dbe7d323
Forgot to commit test for large number support.
2014-03-20 15:45:35 +02:00
Taneli Leppa
0a85d27ee7
V8 needs to be notified when timezone changes. Keep track of timezone changes and notify it.
...
Also added a test.
2014-03-20 11:20:59 +02:00
Taneli Leppa
dd20670546
When passing objects from JS to PHP with mixed keys, some of the keys
...
might get lost or "re-indexed". This fixes it and adds two tests.
2014-03-20 10:35:05 +02:00
Taneli Leppa
54621e18f3
Added checkString() method for checking Javascript syntax.
2014-03-19 17:00:28 +02:00
Patrick Reilly
e68d7073de
Merge pull request #77 from cscott/minor-fixes
...
A pair of minor fixes
2013-10-30 11:45:03 -07:00
C. Scott Ananian
30497766a3
Fix test cases which hard coded the object identity of returned objects.
2013-10-29 15:38:27 -04:00
C. Scott Ananian
2fe87a4cbc
Protect against direct invocation of new V8Object
and new V8Function
.
...
This fixes issue #75 .
2013-10-29 15:37:04 -04:00
Stefan Siegl
18b129b128
Trigger garbage collection within Isolate::Scope
...
Before the idle notifications to V8 were sent without a special
Isolate entered, which results in V8 using it's default isolate
(which we don't use at all). Hence those were pretty useless
anyways (if they were called, which was unlikely).
Besides V8 seems to not trigger the weak object callbacks if
the isolate is destroyed, hence the PHP objects we add-ref'ed
before will leak.
Therefore this removes the previous idle notification logic
and forces garbage collection from the V8Js object destructor.
2013-10-27 00:41:47 +02:00
C. Scott Ananian
f6a6d1e4b5
Rework JavaScript wrapper for PHP objects.
...
Use the NamedPropertyHandler feature of v8 to wrap accesses to PHP properties
and methods from JavaScript. This enables us to support property
set/delete/query.
The `in` and `delete` operators in JavaScript work like the `isset()` and
`unset()` functions in PHP. In particular, a PHP property with a null
value will not be `in` the JavaScript object. (This holds when enumerating
all properties of an object as well.)
Because JavaScript has a single namespace for both properties and methods,
we allow the use of the `__call` method on a PHP object (even if the
PHP class does not natively define the `__call` magic function) in order
to unambiguously invoke a method. Similarly, you can prefix a property
name with `$` to unambiguously access the property. (When enumerating all
properties, properties are `$`-prefixed in order to ensure they are not
conflated with method names.)
2013-10-25 16:47:15 -04:00
C. Scott Ananian
0adefa5048
Add a test for issue 25 (native properties)
2013-10-25 16:47:15 -04:00
C. Scott Ananian
44c329b953
Add a test of PHP magic functions.
2013-10-25 16:47:15 -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
2516e76ff8
Unwrap PHP objects when passing them back from JavaScript to PHP.
2013-10-25 14:17:40 -04:00
Stefan Siegl
bd9483080d
Don't re-wrap PHP objects from V8 to V8Object
2013-10-21 20:00:58 +02:00
Stefan Siegl
683ac347c7
Test export of undeclared properties in derived classes
2013-10-19 02:36:19 +02:00
Stefan Siegl
b888cfce0d
Add test on protected & private properties on derived classes
2013-10-19 02:17:10 +02:00
Stefan Siegl
1f8b605585
Add test on initially initialized properties on V8Js object.
2013-10-19 02:15:37 +02:00
Stefan Siegl
645b0df999
Add test from issue #54
2013-10-18 23:57:26 +02:00
C. Scott Ananian
f85675f169
Make JavaScript function wrappers typesafe.
...
Use the v8::Signature parameter to FunctionTemplate::New to guarantee that
the info->Holder() is of the proper type when `php_v8js_php_callback` is
invoked.
Add test case demonstrating the segfault (which is now prevented).
2013-10-11 23:28:21 -04:00
Stefan Siegl
4f3cbd412b
Make test PHP 5.3 compatible
2013-10-07 14:55:01 +02:00
C. Scott Ananian
035e6faa8b
Implement property_exists()/isset()/empty() on wrapped JavaScript objects.
...
Fixes issue #32 .
2013-10-05 11:56:42 -04:00
Stefan Siegl
f90650d630
Create temporary HandleScope to get & call methods likewise, closes #33
2013-10-03 01:15:51 +02:00
Stefan Siegl
1f4caaeead
Create temporary HandleScope while reading properties
2013-10-03 01:05:03 +02:00
Stefan Siegl
662e491e1f
Pass back v8 functions, don't re-wrap
2013-10-03 00:34:50 +02:00
Stefan Siegl
bc82d13658
Add isolate to key of template cache.
2013-10-02 23:38:26 +02:00
Stefan Siegl
e57e3eed1d
Add tests with multiple V8Js instances
2013-09-29 23:46:19 +02:00
Stefan Siegl
286b0d8ac0
Handle non-construct call
2013-07-12 20:23:12 +02:00
Stefan Siegl
5987d5d3da
Throw exception if __construct is not public
2013-07-12 20:23:12 +02:00
Stefan Siegl
35e9fd849d
Add tests.
2013-07-12 20:23:12 +02:00
Stefan Siegl
a3957f3844
Add test for regression pointed out in pull request #14
2013-07-07 23:04:19 +02:00
Andrew Tch
de2479aca6
fixed tests using absolute urls
2013-05-19 17:56:54 +03:00
Simon Best
91b1a2fbd2
Added a test for CommonJS modules.
2013-05-09 23:14:02 +01:00
Simon Best
916728fa8a
Added simple tests for time limit and memory limit.
2013-04-14 12:31:35 +01:00
Simon Best
7e90439cdf
Make sure all tests and samples use the new exception class name V8JsScriptException.
2013-04-14 00:36:31 +01:00