浏览代码

Make sure all tests and samples use the new exception class name V8JsScriptException.

Simon Best 12 年之前
父节点
当前提交
7e90439cdf

+ 2 - 2
README.md

@@ -43,7 +43,7 @@ API
         public mixed V8Js::executeString( string script [, string identifier [, int flags = V8Js::FLAG_NONE]])
 
         // Returns uncaught pending exception or null if there is no pending exception.
-        public V8JsException V8Js::getPendingException( void )
+        public V8JsScriptException V8Js::getPendingException( void )
 
         /** Static methods **/
 
@@ -56,7 +56,7 @@ API
         public static array V8Js::getExtensions( void )
     }
 
-    final class V8JsException extends Exception
+    final class V8JsScriptException extends Exception
     {
         /* Properties */
         protected string JsFileName = NULL;

+ 1 - 1
samples/test_call.php

@@ -69,6 +69,6 @@ try {
   $blaa->executeString('PHP.obj.foo(1,2,3);', "call_test1 #8.js");
   echo "------------\n";
 
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
   echo $e->getMessage(), "\n";
 }

+ 1 - 1
samples/test_closure.php

@@ -6,6 +6,6 @@ $a->func = function ($a) { echo "Closure..\n"; };
 try {
   $a->executeString("print(PHP.func); PHP.func(1);", "closure_test.js");
   $a->executeString("print(PHP.func); PHP.func(1);", "closure_test.js");
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
   echo $e->getMessage(), "\n";
 }

+ 1 - 1
samples/test_date.php

@@ -4,6 +4,6 @@ $a = new V8Js();
 
 try {
 	var_dump($a->executeString("date = new Date('September 8, 1975 09:00:00'); print(date + '\\n'); date;", "test.js"));
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
 	echo $e->getMessage(), "\n";
 }

+ 1 - 1
samples/test_dumper.php

@@ -54,6 +54,6 @@ try {
   $a->executeString("var patt1=/[^a-h]/g; var_dump(patt1);", "call_test5.js");
   $a->executeString("var_dump(Math.PI, Infinity, null, undefined);", "call_test6.js");
 //  $a->executeString($JS);
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
   echo $e->getMessage(), "\n";
 }

+ 1 - 1
samples/test_exception.php

@@ -19,7 +19,7 @@
     
     try {
       $foo = new Foo();
-    } catch (V8JsException $e) {
+    } catch (V8JsScriptException $e) {
       echo "PHP Exception: ", $e->getMessage(), "\n"; //var_dump($e);
     }
 

+ 1 - 1
samples/test_exception2.php

@@ -27,7 +27,7 @@
     
     try {
       $foo = new Foo();
-    } catch (V8JsException $e) {
+    } catch (V8JsScriptException $e) {
       echo "PHP Exception: ", $e->getMessage(), "\n";
     }
 

+ 1 - 1
samples/test_extend.php

@@ -18,6 +18,6 @@ echo $a;
 
 try {
 	$a->executeString("PHP.mytest(PHP.foo, PHP.my_private, PHP.my_protected);", "test7.js");
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
 	var_dump($e);
 }

+ 4 - 4
samples/test_method.php

@@ -23,13 +23,13 @@ $a->executeString("PHP.myobj.mytest(3.14, 42, null);", "test3.js");
 // Invalid parameters
 try {
 	$a->executeString("PHP.myobj.mytest();", "test4.js");
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
 	echo $e->getMessage(), "\n";
 }
 
 try {
 	$a->executeString("PHP.myobj.mytest('arg1', 'arg2', 'arg3', 'extra_arg');", "test5.js");
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
 	echo $e->getMessage(), "\n";
 }
 
@@ -37,12 +37,12 @@ try {
 try {
 //	date_default_timezone_set("UTC");
 	$a->executeString("date = new Date('September 8, 1975 09:00:00'); PHP.print(date); PHP.myobj.mytest(date, PHP.myobj, new Array(1,2,3));", "test6.js");
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
 	var_dump($e);
 }
 
 try {
 	$a->executeString("PHP.myobj.mytest(PHP.myobj, new Array(1,2,3), new Array('foo', 'bar', PHP.myobj));", "test7.js");
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
 	var_dump($e);
 }

+ 2 - 2
test.php

@@ -139,7 +139,7 @@ $a->executeString("bigarray()", "test1.js");
 try {
   echo($a->executeString($jstparser, "test2.js")), "\n";
   var_dump($a->executeString($jsontemplate, "test1.js"));
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
   echo $e->getMessage();
 }
 
@@ -168,6 +168,6 @@ var_dump($b->executeString("print('foobar\\n');"));
 
 try {
   $b->executeString("foobar; foo();", "extest.js");
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
   var_dump($e, $e->getJsFileName(), $e->getJsLineNumber(), $e->getJsSourceLine(), $e->getJsTrace());
 }

+ 1 - 1
tests/basic.phpt

@@ -14,7 +14,7 @@ $v8 = new V8Js();
 
 try {
 	var_dump($v8->executeString($JS, 'basic.js'));
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
 	var_dump($e);
 }
 ?>

+ 1 - 1
tests/closures_basic.phpt

@@ -10,7 +10,7 @@ $a->func = function ($arg) { echo "Hello {$arg}, I'm Closure!\n"; };
 
 try {
   $a->executeString('print(PHP.func + "\n"); PHP.func("foobar");', "closure_test.js");
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
   echo $e->getMessage(), "\n";
 }
 ?>

+ 1 - 1
tests/closures_dynamic.phpt

@@ -19,7 +19,7 @@ $a->func = function ($arg) use ($b) { return call_user_func($b, $arg); };
 
 try {
   $a->executeString('print(PHP.func + "\n"); print(PHP.func("world") + "\n");', "closure_test.js");
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
   echo $e->getMessage(), "\n";
 }
 ?>

+ 1 - 1
tests/construct.phpt

@@ -14,7 +14,7 @@ $v8->__construct();
 
 try {
 	$v8->executeString($JS, 'basic.js');
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
 	var_dump($e);
 }
 ?>

+ 5 - 5
tests/context_preserving.phpt

@@ -27,7 +27,7 @@ $a->ctx = '#1';
 try {
 	echo '1. ';
 	$a->executeString($JS_set, 'set.js');
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
 	var_dump($e);
 }
 
@@ -38,7 +38,7 @@ $b->ctx = '#2';
 try {
 	echo '2. ';
 	$b->executeString($JS_change, 'change.js');
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
 	var_dump($e);
 }
 
@@ -46,7 +46,7 @@ try {
 try {
 	echo '3. ';
 	$a->executeString($JS_read, 'read.js');
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
 	var_dump($e);
 }
 
@@ -54,7 +54,7 @@ try {
 try {
 	echo '4. ';
 	$a->executeString($JS_change, 'change.js');
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
 	var_dump($e);
 }
 
@@ -62,7 +62,7 @@ try {
 try {
 	echo '5. ';
 	$a->executeString($JS_read, 'read.js');
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
 	var_dump($e);
 }
 ?>

+ 2 - 2
tests/context_separation.phpt

@@ -14,7 +14,7 @@ $a->foo = 'from first.js';
 
 try {
 	$a->executeString($JS, 'first.js');
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
 	var_dump($e);
 }
 
@@ -25,7 +25,7 @@ $b->foo = 'from second.js';
 
 try {
 	$b->executeString($JS, 'second.js');
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
 	var_dump($e);
 }
 

+ 3 - 3
tests/exception.phpt

@@ -1,5 +1,5 @@
 --TEST--
-Test V8::executeString() : V8JsException
+Test V8::executeString() : V8JsScriptException
 --SKIPIF--
 <?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
 --FILE--
@@ -13,13 +13,13 @@ $v8 = new V8Js();
 
 try {
 	$v8->executeString($JS, 'exception.js');
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
 	var_dump($e);
 }
 ?>
 ===EOF===
 --EXPECTF--
-object(V8JsException)#2 (11) {
+object(V8JsScriptException)#2 (11) {
   ["message":protected]=>
   string(75) "exception.js:1: ReferenceError: this_function_does_not_exist is not defined"
   ["string":"Exception":private]=>

+ 1 - 1
tests/exception_propagation_1.phpt

@@ -27,7 +27,7 @@ class Foo {
     
 try {
 	$foo = new Foo();
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
 	echo "PHP Exception: ", $e->getMessage(), "\n"; //var_dump($e);
 }
 ?>

+ 2 - 2
tests/exception_propagation_2.phpt

@@ -27,13 +27,13 @@ class Foo {
     
 try {
 	$foo = new Foo();
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
 	echo "PHP Exception: ", $e->getMessage(), "\n"; //var_dump($e);
 }
 ?>
 ===EOF===
 --EXPECTF--
-object(V8JsException)#3 (11) {
+object(V8JsScriptException)#3 (11) {
   ["message":protected]=>
   string(49) "throw_0:1: ReferenceError: fooobar is not defined"
   ["string":"Exception":private]=>

+ 1 - 1
tests/exception_propagation_3.phpt

@@ -26,7 +26,7 @@ class Foo {
     
 try {
 	$foo = new Foo();
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
 	echo "PHP Exception: ", $e->getMessage(), "\n";
 }
 ?>

+ 1 - 1
tests/execute_flags.phpt

@@ -15,7 +15,7 @@ try {
 	var_dump($v8->executeString($js, 'assoc_no_flags.js'));
 	echo "---\n";
 	var_dump($v8->executeString($js, 'assoc_force_to_array.js', V8Js::FLAG_FORCE_ARRAY));
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
 	var_dump($e);
 }
 ?>

+ 1 - 1
tests/execute_flags_args.phpt

@@ -17,7 +17,7 @@ try {
 	$v8->executeString($js, 'no_flags.js');
 	echo "---\n";
 	$v8->executeString($js, 'force_to_array.js', V8Js::FLAG_FORCE_ARRAY);
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
 	var_dump($e);
 }
 ?>

+ 4 - 4
tests/object_method_call.phpt

@@ -36,13 +36,13 @@ $a->executeString("PHP.myobj.mytest(3.14, 42, null);", "test3.js");
 // Invalid parameters
 try {
 	$a->executeString("PHP.myobj.mytest();", "test4.js");
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
 	echo $e->getMessage(), "\n";
 }
 
 try {
 	$a->executeString("PHP.myobj.mytest('arg1', 'arg2', 'arg3', 'extra_arg');", "test5.js");
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
 	echo $e->getMessage(), "\n";
 }
 
@@ -50,14 +50,14 @@ try {
 	echo "\nTEST: Javascript Date -> PHP DateTime\n";
 	echo "======================================\n";
 	$a->executeString("date = new Date('September 8, 1975 09:00:00 GMT'); print(date.toUTCString() + '\\n'); PHP.myobj.mydatetest(date, 'foo');", "test6.js");
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
 	echo $e->getMessage(), "\n";
 }
 
 // Array / Object
 try {
 	$a->executeString("PHP.myobj.mytest(PHP.myobj, new Array(1,2,3), new Array('foo', 'bar', PHP.myobj));", "test7.js");
-} catch (V8JsException $e) {
+} catch (V8JsScriptException $e) {
 	var_dump($e);
 }