express-state
Advanced tools
Comparing version 1.1.1 to 1.1.2
Express State Change History | ||
============================ | ||
1.1.2 (2014-02-21) | ||
------------------ | ||
* Fixed issue with line terminator characters (`U+2028` and `U+2029`) being | ||
handled differently in JavaScript vs. JSON by escaping them. | ||
([#21][], [#22][]: @norwood, @mathiasbynens) | ||
[#21]: https://github.com/yahoo/express-state/issues/21 | ||
[#22]: https://github.com/yahoo/express-state/issues/22 | ||
1.1.1 (2014-01-25) | ||
@@ -5,0 +17,0 @@ ------------------ |
@@ -7,12 +7,14 @@ 'use strict'; | ||
var IS_NATIVE_CODE_REGEX = /\{\s*\[native code\]\s*\}/g, | ||
PLACE_HOLDER_REGEX = /"@__(FUNCTION|REGEXP)_(\d+)__@"/g, | ||
UNSAFE_HTML_CHARS_REGEX = /[<>\/]/g; | ||
var IS_NATIVE_CODE_REGEX = /\{\s*\[native code\]\s*\}/g, | ||
PLACE_HOLDER_REGEX = /"@__(FUNCTION|REGEXP)_(\d+)__@"/g, | ||
UNSAFE_CHARS_REGEX = /[<>\/\u2028\u2029]/g; | ||
// Mapping of unsafe HTML chars to their Unicode char counterparts which are | ||
// safe to use in JavaScript strings. | ||
var UNICODE_HTML_CHARS = { | ||
'<': '\\u003C', | ||
'>': '\\u003E', | ||
'/': '\\u002F' | ||
// Mapping of unsafe HTML and invalid JavaScript line terminator chars to their | ||
// Unicode char counterparts which are safe to use in JavaScript strings. | ||
var UNICODE_CHARS = { | ||
'<' : '\\u003C', | ||
'>' : '\\u003E', | ||
'/' : '\\u002F', | ||
'\u2028': '\\u2028', | ||
'\u2029': '\\u2029' | ||
}; | ||
@@ -46,7 +48,7 @@ | ||
// Replace unsafe HTML chars with their safe Unicode char counterpart. This | ||
// _must_ happen before the regexps and functions are serialized and added | ||
// back to the string. | ||
str = str.replace(UNSAFE_HTML_CHARS_REGEX, function (unsafeChar) { | ||
return UNICODE_HTML_CHARS[unsafeChar]; | ||
// Replace unsafe HTML and invalid JavaScript line terminator chars with | ||
// their safe Unicode char counterpart. This _must_ happen before the | ||
// regexps and functions are serialized and added back to the string. | ||
str = str.replace(UNSAFE_CHARS_REGEX, function (unsafeChar) { | ||
return UNICODE_CHARS[unsafeChar]; | ||
}); | ||
@@ -53,0 +55,0 @@ |
{ | ||
"name": "express-state", | ||
"description": "Share server-side state with the client-side of an Express app via JavaScript.", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"homepage": "https://github.com/yahoo/express-state", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40132
267