Skip to content

Commit

Permalink
#97 remove unnecessary json parser fallback that uses eval
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Feb 12, 2015
1 parent 3bd1707 commit 6da0611
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions requirejs-plugins/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ define( function( require ) {
// constants
var FALLBACK_LOCALE = 'en';

var parse = (typeof JSON !== 'undefined' && typeof JSON.parse === 'function') ? JSON.parse : function( text ) { return eval( '(' + text + ')' ); };
var parse = JSON.parse;

// Cache the loaded strings so they only have to be read once through file.read (for performance)
var cache = {};
Expand Down Expand Up @@ -102,7 +102,7 @@ define( function( require ) {
if ( !config.isBuild ) {

// strings may be specified via the 'strings' query parameter, value is expected to be encoded to avoid URI-reserved characters
var queryParameterStrings = JSON.parse( decodeURIComponent( phet.chipper.getQueryParameter( 'strings' ) || '{}' ) );
var queryParameterStrings = parse( decodeURIComponent( phet.chipper.getQueryParameter( 'strings' ) || '{}' ) );

// Read the locale from a query parameter, if it is there, or use english
locale = phet.chipper.getQueryParameter( 'locale' ) || config.phetLocale || 'en';
Expand Down

0 comments on commit 6da0611

Please sign in to comment.