prototype: Avoid the try..catch block in Ajax.Response#_getResponseJSON unless required.

This commit is contained in:
Tobie Langel 2007-10-22 12:04:06 +00:00
parent 0100aee1a0
commit f870fba94f
2 changed files with 6 additions and 4 deletions

View File

@ -1,5 +1,7 @@
*SVN*
* Avoid the try..catch block in Ajax.Response#_getResponseJSON unless required. [Tobie Langel]
* Add more tests to Element.update. Closes #9327. [Tobie Langel]
* Make the Ajax.Response#headerJSON property correctly decode unicode characters. Closes #9285. [Marius Feraru, Tobie Langel]

View File

@ -287,11 +287,11 @@ Ajax.Response = Class.create({
_getResponseJSON: function() {
var options = this.request.options;
if (!options.evalJSON || (options.evalJSON != 'force' &&
!(this.getHeader('Content-type') || '').include('application/json')))
return null;
try {
if (options.evalJSON == 'force' || (options.evalJSON &&
(this.getHeader('Content-type') || '').include('application/json')))
return this.transport.responseText.evalJSON(options.sanitizeJSON);
return null;
return this.transport.responseText.evalJSON(options.sanitizeJSON);
} catch (e) {
this.request.dispatchException(e);
}