Heine

  • home
  • drupal
  • drupal core commits
  • about
Home › Drupal Core Commits

Commit 339518 by dries

- Patch #673884 by casey, mfer: optimize Drupal.parseJSON.

--- <a href="http://drupalcode.org/viewvc/drupal/drupal/misc/ajax.js" title="http://drupalcode.org/viewvc/drupal/drupal/misc/ajax.js" rel="nofollow">http://drupalcode.org/viewvc/drupal/drupal/misc/ajax.js</a>        2010/03/06 07:28:29     1.11
+++ <a href="http://drupalcode.org/viewvc/drupal/drupal/misc/ajax.js" title="http://drupalcode.org/viewvc/drupal/drupal/misc/ajax.js" rel="nofollow">http://drupalcode.org/viewvc/drupal/drupal/misc/ajax.js</a>        2010/03/10 15:14:38     1.12
@@ -132,7 +132,7 @@
       // Sanity check for browser support (object expected).
       // When using iFrame uploads, responses must be returned as a string.
       if (typeof response == 'string') {
-        response = Drupal.parseJson(response);
+        response = $.parseJson(response);
       }
       return ajax.success(response, status);
     },

--- <a href="http://drupalcode.org/viewvc/drupal/drupal/misc/drupal.js" title="http://drupalcode.org/viewvc/drupal/drupal/misc/drupal.js" rel="nofollow">http://drupalcode.org/viewvc/drupal/drupal/misc/drupal.js</a>  2010/03/09 20:52:27     1.64
+++ <a href="http://drupalcode.org/viewvc/drupal/drupal/misc/drupal.js" title="http://drupalcode.org/viewvc/drupal/drupal/misc/drupal.js" rel="nofollow">http://drupalcode.org/viewvc/drupal/drupal/misc/drupal.js</a>  2010/03/10 15:14:38     1.65
@@ -248,18 +248,6 @@
 };
 
 /**
- * Parse a JSON response.
- *
- * The result is either the JSON object, or an object with 'status' 0 and 'data' an error message.
- */
-Drupal.parseJson = function (data) {
-  if ((data.substring(0, 1) != '{') && (data.substring(0, 1) != '[')) {
-    return { status: 0, data: data.length ? data : Drupal.t('Unspecified error') };
-  }
-  return eval('(' + data + ');');
-};
-
-/**
  * Freeze the current body height (as minimum height). Used to prevent
  * unnecessary upwards scrolling when doing DOM manipulations.
  */

No votes yet
  • Drupal Core
  • Download patch

Recent posts

  • Planet Drupal past and current
  • Help! - Cannot access a global variable.
  • Why is my module's update hook not listed on update.php's selection form?
  • How do I add a class to a link generated with l()
  • ZeroDayScan - Full path disclosure bug in Drupal 6.16 (0day)
more

Security reviews

  • Afraid custom code makes your site vulnerable?
  • You don't really trust that module you just downloaded from Drupal.org?

Sleep better after a security review.

Tags

Captcha CSRF Drupal embed Input Format modx OpenID Performance Planet Drupal rants Security Varnish
more tags
  • home
  • drupal
  • drupal core commits
  • about

Copyright © 2010 by Heine Deelstra. All rights reserved.