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