Navigation Menu

Skip to content

Commit

Permalink
prototype: Avoid the try..catch block in Ajax.Response#_getResponseJS…
Browse files Browse the repository at this point in the history
…ON unless required.
  • Loading branch information
tobie committed Oct 22, 2007
1 parent 0100aee commit f870fba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
@@ -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]
Expand Down
8 changes: 4 additions & 4 deletions src/ajax.js
Expand Up @@ -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);
}
Expand Down

0 comments on commit f870fba

Please sign in to comment.