Opened 9 years ago

Closed 7 years ago

#10865 closed defect (patchwelcome) loads TZ data via XHR, and synchronously

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

Description (last modified by Adam Peller)

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 (4)

comment:1 Changed 9 years ago by James Burke

Component: GeneralDojox
Owner: changed from anonymous to Adam Peller

comment:2 Changed 9 years ago by Adam Peller

Description: modified (diff)
Milestone: tbdfuture

Agreed. JSONP might also be a good solution. Nathan generously devoted some time to starting this project, but as of now I'm not sure anyone is maintaining it. Patches are welcome.

comment:3 Changed 9 years ago by Adam Peller

Cc: Nathan Toone added

comment:4 Changed 7 years ago by bill

Resolution: patchwelcome
Status: newclosed
Note: See TracTickets for help on using tickets.