public final class EvalMinifier extends Object
eval builtin, tries to reduce the number of bytes sent over
the wire by turning it into a Javascript expression that pools constants.| Constructor and Description |
|---|
EvalMinifier() |
| Modifier and Type | Method and Description |
|---|---|
static String |
minify(String jsonish)
Renders JSON-like content safe for use with Javascript
eval. |
static String |
minify(String jsonish,
int maximumNestingDepth)
Same as
minify(String), but allows to set custom maximum nesting depth. |
public static String minify(String jsonish)
eval.
The output is a Javascript expression, not a statement, so if it
contains an object ({properties}) then it
still needs to be wrapped in parentheses before being passed to
eval as via eval('(' + s + ')') or eval('0,' + s).
jsonish - a string of JSON-like content as defined by
JsonSanitizer.<script></script> element or inside an XML
<![CDATA[...]]> section.public static String minify(String jsonish, int maximumNestingDepth)
minify(String), but allows to set custom maximum nesting depth.jsonish - a string of JSON-like content as defined by
JsonSanitizer.maximumNestingDepth - the maximum nesting depth for the JsonSanitizerminify(String)Copyright © 2017 OWASP. All rights reserved.