Use FooValue() functions.
Use the JSVal member functions to replace JSVAL_IS_* and JSVAL_TO_*.