Github user mike-jumper commented on a diff in the pull request:

    
https://github.com/apache/incubator-guacamole-client/pull/210#discussion_r151608032
  
    --- Diff: guacamole-common-js/src/main/webapp/modules/Tunnel.js ---
    @@ -215,6 +215,24 @@ Guacamole.HTTPTunnel = function(tunnelURL, 
crossDomain) {
         var receive_timeout = null;
     
         /**
    +     * Additional headers to be sent in tunnel requests. This dictionary 
can be
    +     * populated with key/value header pairs to pass information such as 
authentication
    +     * tokens, etc.
    +     */
    +    var extraHeaders = {};
    +
    +    /**
    +     * Adds the configured additional headerss to the given request.
    +     *
    +     * @private
    +     */
    +    function add_extra_headers(request) {
    +        for (name in tunnel.extraHeaders) {
    --- End diff --
    
    `name` here is implicitly declared, and thus [will actually be on the 
global 
scope](http://blog.niftysnippets.org/2008/03/horror-of-implicit-globals.html). 
Variables need to be explicitly declared to avoid such scary defaults. You'll 
need something like:
    
        for (var name in tunnel.extraHeaders)
    
    to properly restrict `name` to the scope of its function.


---

Reply via email to