Fix issue #8232. Changed the ExecuteJavaScript extension method to correctly detect if the script result is convertible to the generic type.