You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Martin Hejnfelt (JIRA)" <ji...@apache.org> on 2017/03/24 14:45:41 UTC

[jira] [Created] (THRIFT-4132) Generated JavaScript code is missing a undefined check

Martin Hejnfelt created THRIFT-4132:
---------------------------------------

             Summary: Generated JavaScript code is missing a undefined check
                 Key: THRIFT-4132
                 URL: https://issues.apache.org/jira/browse/THRIFT-4132
             Project: Thrift
          Issue Type: Bug
          Components: JSON - Compiler
    Affects Versions: 0.10.0
         Environment: All
            Reporter: Martin Hejnfelt


The generated code of a *_result object can take an "args" argument to its "constructor". However, at least when using WebSocket, the *_result object is not passed an "args" parameter, hence args is undefined. However the code still makes an instanceof test on args, causing an exception to be thrown at least on newer browsers (Tested on Chrome 57 and Firefox 52). Adding an "args !== undefined &&" in front of this, makes everything work nicely again.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Re: [jira] [Created] (THRIFT-4132) Generated JavaScript code is missing a undefined check

Posted by Martin Hejnfelt <mh...@newtec.dk>.
Patch

2017-03-24 15:45 GMT+01:00 Martin Hejnfelt (JIRA) <ji...@apache.org>:

> Martin Hejnfelt created THRIFT-4132:
> ---------------------------------------
>
>              Summary: Generated JavaScript code is missing a undefined
> check
>                  Key: THRIFT-4132
>                  URL: https://issues.apache.org/jira/browse/THRIFT-4132
>              Project: Thrift
>           Issue Type: Bug
>           Components: JSON - Compiler
>     Affects Versions: 0.10.0
>          Environment: All
>             Reporter: Martin Hejnfelt
>
>
> The generated code of a *_result object can take an "args" argument to its
> "constructor". However, at least when using WebSocket, the *_result object
> is not passed an "args" parameter, hence args is undefined. However the
> code still makes an instanceof test on args, causing an exception to be
> thrown at least on newer browsers (Tested on Chrome 57 and Firefox 52).
> Adding an "args !== undefined &&" in front of this, makes everything work
> nicely again.
>
>
>
> --
> This message was sent by Atlassian JIRA
> (v6.3.15#6346)
>



-- 
Martin Hejnfelt