Opened 10 years ago

Last modified 9 years ago

#14222 closed enhancement

Not existing i18n file causes Firefox 7 to process dojo if website has a 404 reply handler — at Initial Version

Reported by: andreas.stankewitz Owned by: Rawld Gill
Priority: high Milestone: 1.8
Component: Loader Version: 1.6.1
Keywords: i18n loader 404 FF7 Cc: [email protected]
Blocked By: Blocking:

Description

This is a suggestion to make loader.js more fault tolerant to bad resource files.

A special setup, that is maybe not so special for websites with CMS in international environments, caused dojo failure with Firefox 7. The setup:

Using dojo with i18n in a language that does not provide a translation file, e.g. PasteFromWord? (Editor).

Having a 404 error handler installed on the website, that forwards to the home page that shows a special message like: "Sorry, the file is not available", but without returning a 404 code.

loader.js tries to parse the returned page as json, and of course fails. The problem with Firefox 7 is, that further dojo use fails, too. Firefox 4 did not have this problem, and IE and Chrome also not.

It took quite some time to find the underlying problem, and I wonder, if it is not possible to make loader.js more fault tolerant. My suggestion:

Wrap this line (116 in 1.6.1) into a try/catch block:

var value = deval?(contents);

Could look like this:

try{

var value = deval?(contents); if(cb){ cb(value); }

}catch(e){

console.error("failed parsing " + uri + " with error: " + e); contents = null;

}

The loader is too central, so I cannot oversee the consequences of this change - I'm sorry that my resources are too limited to do further investigation, but I think, this enhancement would help a lot to make dojo more stable, as a certain webserver configuration would not make dojo to fail working.

Change History (0)

Note: See TracTickets for help on using tickets.