Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/data/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,14 @@
throw new Error("glow.data.decodeJson: cannot decode item");
}

// If JSON.parse() is available use that instead of eval().
// options that are passed to decodeJson() are only safety
// guarantees which are automatically handled with JSON.parse(),
// hence return immediately without acknowledging the options.

if(window.JSON && window.JSON.parse)
return window.JSON.parse(text);

options = options || {};
options.safeMode = options.safeMode || false;

Expand Down