mirror of
https://github.com/phpv8/v8js.git
synced 2024-11-09 15:18:41 +00:00
e9e90bac65
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
42 lines
863 B
PHP
42 lines
863 B
PHP
--TEST--
|
|
Test V8::setTimeLimit() : Time limit can be prolonged
|
|
--SKIPIF--
|
|
<?php
|
|
require_once(dirname(__FILE__) . '/skipif.inc');
|
|
|
|
if (getenv("SKIP_SLOW_TESTS")) {
|
|
die("skip slow test");
|
|
}
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
|
|
$JS = <<< EOT
|
|
var text = "abcdefghijklmnopqrstuvwyxz0123456789";
|
|
/* Spend 75 * >10ms in the loop, i.e. at least 750ms; hence
|
|
* it should be killed if prolonging doesn't work. */
|
|
for (var j = 0; j < 30; ++j) {
|
|
PHP.prolongTimeLimit();
|
|
var start = (new Date()).getTime();
|
|
var encoded = encodeURI(text);
|
|
|
|
while ((new Date()).getTime() - start < 10) {
|
|
/* pass about 10ms in the loop, then prolong */
|
|
var encoded = encodeURI(text);
|
|
}
|
|
}
|
|
EOT;
|
|
|
|
$v8 = new V8Js();
|
|
$v8->setTimeLimit(300);
|
|
|
|
$v8->prolongTimeLimit = function() use ($v8) {
|
|
$v8->setTimeLimit(300);
|
|
};
|
|
|
|
$v8->executeString($JS);
|
|
?>
|
|
===EOF===
|
|
--EXPECTF--
|
|
===EOF===
|