Large text messages (e.g. 900 KB message for the horde cvs -> git
import) was crashing on FF 3 due to a stack size issue. The prototypejs
code is using a matching regex to store the entire data part of the JSON
payload. No reason to do that - much more efficient to use string-based
functions to match the front and rear of the string.
}
};
+
+/* More efficient String.unfilterJSON() function. */
+Object.extend(String.prototype, {
+ unfilterJSON: function(filter) {
+ if (filter) {
+ return this.replace(filter, '$1');
+ } else if (this.startsWith('/*-secure-') &&
+ this.endsWith('*/')) {
+ return this.slice(10, -2);
+ }
+ return this;
+ }
+});