[OpenLayers-Trac] [OpenLayers] #1493: Update JSON Format Regex to match json.org
OpenLayers
trac at openlayers.org
Sat Apr 5 21:57:47 EDT 2008
#1493: Update JSON Format Regex to match json.org
----------------------------+-----------------------------------------------
Reporter: crschmidt | Owner: tschaub
Type: bug | Status: new
Priority: minor | Milestone: 2.6 Release
Component: Format.GeoJSON | Version: 2.6 RC1
Keywords: | State:
----------------------------+-----------------------------------------------
JSON.org has an updated regex in their json.js since we wrote Format.JSON:
it is described as such:
{{{
// We split the first stage into 4 regexp operations in order to work
around
// crippling inefficiencies in IE's and Safari's regexp engines. First we
// replace all backslash pairs with '@' (a non-JSON character). Second, we
// replace all simple value tokens with ']' characters. Third, we delete
all
// open brackets that follow a colon or comma or that begin the text.
Finally,
// we look to see that the remaining characters are only whitespace or ']'
or
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for
eval.
}}}
I ran into a regression that essentially means no large GeoJSON strings
can be used in Safari 3.1: I filed a ticket in their bug tracker
(http://bugs.webkit.org/show_bug.cgi?id=18327), but instead of waiting for
a fix there, we can just improve Format.JSON.
I have confirmed that this works, and that all Format.JSON tests continue
to pass in Safari, Opera, Firefox, and IE. (We don't have any tests over
25000 characters at this time, so we never actually failed tests in Safari
3.1, just real usage.)
Since this change in Safari 3.1 essentially makes GeoJSON unusable for
most purposes, I'd like to consider this a blocker for RC2.
--
Ticket URL: <http://trac.openlayers.org/ticket/1493>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer
More information about the Trac
mailing list