You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Hudson (JIRA)" <ji...@apache.org> on 2011/05/22 12:19:47 UTC

[jira] [Commented] (THRIFT-1176) Thrift compiler global leakage js

    [ https://issues.apache.org/jira/browse/THRIFT-1176?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13037555#comment-13037555 ] 

Hudson commented on THRIFT-1176:
--------------------------------

Integrated in Thrift #145 (See [https://builds.apache.org/hudson/job/Thrift/145/])
    THRIFT-1176 Thrift compiler global leakage js
Patch: Dan Di Spaltro

includes updated test.html to get qunit.js with correct mime-type(IE9 complains)
Fixed by Roger Meier

roger : http://svn.apache.org/viewvc/?view=rev&rev=1125892
Files : 
* /thrift/trunk/compiler/cpp/src/generate/t_js_generator.cc
* /thrift/trunk/lib/js/test/test.html


> Thrift compiler global leakage js
> ---------------------------------
>
>                 Key: THRIFT-1176
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1176
>             Project: Thrift
>          Issue Type: Bug
>          Components: Node.js - Compiler
>    Affects Versions: 0.6
>            Reporter: Dan Di Spaltro
>            Assignee: Roger Meier
>            Priority: Trivial
>
> Below I added the var qualifier on the declare field function.  This is fairly trivial and fixes the global scope leak.
> {code} 
> diff --git a/compiler/cpp/src/generate/t_js_generator.cc b/compiler/cpp/src/generate/t_js_generator.cc
> index a654fc9..c4f201f 100644
> --- a/compiler/cpp/src/generate/t_js_generator.cc
> +++ b/compiler/cpp/src/generate/t_js_generator.cc
> @@ -1623,7 +1623,7 @@ string t_js_generator::declare_field(t_field* tfield, bool init, bool obj) {
>    string result = "this." + tfield->get_name();
>  
>    if(!obj){
> -      result = tfield->get_name();
> +      result = "var " + tfield->get_name();
>    }
>  
>    if (init) {
> {code} 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira