[arquillian-issues] [JBoss JIRA] (ARQGRA-496) JavaScript interface returns null instead of false for Booleans

Vsevolod Golovanov (JIRA) issues at jboss.org
Fri Jan 20 06:27:00 EST 2017


Vsevolod Golovanov created ARQGRA-496:
-----------------------------------------

             Summary: JavaScript interface returns null instead of false for Booleans
                 Key: ARQGRA-496
                 URL: https://issues.jboss.org/browse/ARQGRA-496
             Project: Arquillian Graphene
          Issue Type: Bug
    Affects Versions: 2.1.0.Final
            Reporter: Vsevolod Golovanov


{code}
@JavaScript(value = "MyObject")
public interface MyJsInterface {

	Boolean getSomeValue();

}
{code}
If in js MyObject.someValue === false, then attempting to get the value via Graphene's MyJsInterface will result in null getting returned, instead of false.

If you declare a primitive boolean return type, then null will get silently 'casted' to false, but that's not something I want either. I want to distinguish the three states.

{code:title=call.js/invokeInterface}
if (property && target[property]) {
    return target[property];
}
{code}  
There are 2 problems here.
# Instead of {{target\[property\]}} there should be an explicit {{typeof !== 'undefined') check.
# When invokeInterface doesn't find neither getter, nor setter, nor method it quits without returning or throwing anything. There should be some kind of explicit handling if it can't find property/method at all.



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the arquillian-issues mailing list