Opened 12 years ago

Last modified 9 years ago

#10865 closed defect loads TZ data via XHR, and synchronously — at Initial Version

Reported by: xander76 Owned by: anonymous
Priority: high Milestone: future
Component: Dojox Version: 1.4.0
Keywords: Cc: Nathan Toone
Blocked By: Blocking:


We have a page that's working fine on a developer's box, but when we move it to our test servers, it breaks. Turns out that it's because of this line in dojox/date/timezone.js:


url: timezoneFileBasePath + "/" + fileName, sync: true, Needs to be syncronous so we can return values handleAs: "olson-zoneinfo", load: loadZoneObj, error: errorLoadingZoneFile


By default, timezoneFileBasePath is figured out from the moduleUrl for, although you can set timezoneFileBasePath in dojo.config. There are two problems with this:

1) When you deploy dojo in a cross-domain loading situation, this breaks because you can't XHR to the cross-domain. You are forced to deploy the zoneinfo files to your main web server and use the dojo.config.timeZoneFileBasePath variable.

2) Synchronous XHRs are really bad practice. As long as the request is outstanding, most browsers are completely non-responsive. As in: often even the back button is disabled; the whole thing is just locked up. If the server or network causes the request to take a few seconds, you've completely locked the browser, which is very bad as default behavior.

I would recommend wrapping the text in the data files in a string and function call, adding a dojo.provide at the top, and then dojo.requiring it just like every other JS resource. There are probably some other solutions, but this is the one that occurs to me first offhand.

Change History (0)

Note: See TracTickets for help on using tickets.