Fix issue #8232. Re-submission of #293.

Changed the ExecuteJavaScript extension method to correctly detect if the script result is convertible to the generic type.

Please note that I have signed the CLA.