a.martin

Error in javascript console, ConfigManager.js & XHR2 (Chrome, FF, IE 10+)

Discussion created by a.martin on Aug 19, 2014
Latest reply on Aug 25, 2014 by a.martin

Hi there,We are customizing a webapp generated with the Web App Builder and we are getting the following error in the console whenever the application starts:

 

 

Object {url: "config.json", options: a, getHeader: function, xhr: XMLHttpRequest, loaded: 5805…} "

 

 

 

The error happens only in Chrome & Firefox, not in IE 9.

 

We tracked it down to jimu/ConfigManager.js, line 120 in the loadConfig function:

 

          ... 
           }), lang.hitch(this, function (err) {
                console.error(err);
                configDef.reject(err);
                //}));
            }), lang.hitch(this, function (err) {
                console.error(err);
                configDef.reject(err);
            }));

 

This excerpt corresponds with the end of a xhr.then dojo call. According the dojo docs, the last argument of the then function is a callback which will handle the progress event on browsers that support XHR2. As we can se here the code in ConfigManager.js rejects the deferred on the progress event and writes the request object to the console. I think the progress event shouldn't cause a reject of the Deferred.

 

XHR2 is supported in Chrome, Firefox & IE 10+, so this error will be shown on this platforms.

 

To mitigate the error I just changed de above code to the followin excerpt, which fixed the issue.

 

     ... 
           }), lang.hitch(this, function (err) {
                console.error(err);
                configDef.reject(err);
                //}));
            }), lang.hitch(this, function (err) {
                console.info(err);
            }));

Outcomes