event: "break",
body: { invocationText: this.exec_state_.frame(0).invocationText(),
}
- }
+ };
// Add script related information to the event if available.
var script = this.func().script();
o.body.breakpoints.push(number);
}
}
-
- return SimpleObjectToJSON_(o);
+ return JSON.stringify(ObjectToProtocolObject_(o));
};
o.event = "exception";
o.body = { uncaught: this.uncaught_,
exception: MakeMirror(this.exception_)
- }
+ };
// Exceptions might happen whithout any JavaScript frames.
if (this.exec_state_.frameCount() > 0) {
ProtocolMessage.prototype.toJSONProtocol = function() {
// Encode the protocol header.
- var json = '{';
- json += '"seq":' + this.seq;
+ var json = {};
+ json.seq= this.seq;
if (this.request_seq) {
- json += ',"request_seq":' + this.request_seq;
+ json.request_seq = this.request_seq;
}
- json += ',"type":"' + this.type + '"';
+ json.type = this.type;
if (this.event) {
- json += ',"event":' + StringToJSON_(this.event);
+ json.event = this.event;
}
if (this.command) {
- json += ',"command":' + StringToJSON_(this.command);
+ json.command = this.command;
}
if (this.success) {
- json += ',"success":' + this.success;
+ json.success = this.success;
} else {
- json += ',"success":false';
+ json.success = false;
}
if (this.body) {
- json += ',"body":';
// Encode the body part.
+ var bodyJson;
var serializer = MakeMirrorSerializer(true, this.options_);
if (this.body instanceof Mirror) {
- json += serializer.serializeValue(this.body);
+ bodyJson = serializer.serializeValue(this.body);
} else if (this.body instanceof Array) {
- json += '[';
+ bodyJson = [];
for (var i = 0; i < this.body.length; i++) {
- if (i != 0) json += ',';
if (this.body[i] instanceof Mirror) {
- json += serializer.serializeValue(this.body[i]);
+ bodyJson.push(serializer.serializeValue(this.body[i]));
} else {
- json += SimpleObjectToJSON_(this.body[i], serializer);
+ bodyJson.push(ObjectToProtocolObject_(this.body[i], serializer));
}
}
- json += ']';
} else {
- json += SimpleObjectToJSON_(this.body, serializer);
+ bodyJson = ObjectToProtocolObject_(this.body, serializer);
}
- json += ',"refs":';
- json += serializer.serializeReferencedObjects();
+ json.body = bodyJson;
+ json.refs = serializer.serializeReferencedObjects();
}
if (this.message) {
- json += ',"message":' + StringToJSON_(this.message) ;
+ json.message = this.message;
}
if (this.running) {
- json += ',"running":true';
+ json.running = true;
} else {
- json += ',"running":false';
+ json.running = false;
}
- json += '}';
- return json;
+ return JSON.stringify(json);
}
/**
- * Convert an Object to its JSON representation (see http://www.json.org/).
- * This implementation simply runs through all string property names and adds
- * each property to the JSON representation for some predefined types. For type
- * "object" the function calls itself recursively unless the object has the
- * function property "toJSONProtocol" in which case that is used. This is not
- * a general implementation but sufficient for the debugger. Note that circular
- * structures will cause infinite recursion.
- * @param {Object} object The object to format as JSON
+ * Convert an Object to its debugger protocol representation. The representation
+ * may be serilized to a JSON object using JSON.stringify().
+ * This implementation simply runs through all string property names, converts
+ * each property value to a protocol value and adds the property to the result
+ * object. For type "object" the function will be called recursively. Note that
+ * circular structures will cause infinite recursion.
+ * @param {Object} object The object to format as protocol object.
* @param {MirrorSerializer} mirror_serializer The serializer to use if any
* mirror objects are encountered.
- * @return {string} JSON formatted object value
+ * @return {Object} Protocol object value.
*/
-function SimpleObjectToJSON_(object, mirror_serializer) {
- var content = [];
+function ObjectToProtocolObject_(object, mirror_serializer) {
+ var content = {};
for (var key in object) {
// Only consider string keys.
if (typeof key == 'string') {
- var property_value = object[key];
-
// Format the value based on its type.
- var property_value_json;
- switch (typeof property_value) {
- case 'object':
- if (property_value instanceof Mirror) {
- property_value_json = mirror_serializer.serializeValue(property_value);
- } else if (typeof property_value.toJSONProtocol == 'function') {
- property_value_json = property_value.toJSONProtocol(true)
- } else if (IS_ARRAY(property_value)){
- property_value_json = SimpleArrayToJSON_(property_value, mirror_serializer);
- } else {
- property_value_json = SimpleObjectToJSON_(property_value, mirror_serializer);
- }
- break;
-
- case 'boolean':
- property_value_json = BooleanToJSON_(property_value);
- break;
-
- case 'number':
- property_value_json = NumberToJSON_(property_value);
- break;
-
- case 'string':
- property_value_json = StringToJSON_(property_value);
- break;
-
- default:
- property_value_json = null;
- }
-
+ var property_value_json = ValueToProtocolValue_(object[key],
+ mirror_serializer);
// Add the property if relevant.
- if (property_value_json) {
- content.push(StringToJSON_(key) + ':' + property_value_json);
+ if (!IS_UNDEFINED(property_value_json)) {
+ content[key] = property_value_json;
}
}
}
-
- // Make JSON object representation.
- return '{' + content.join(',') + '}';
+
+ return content;
}
+
/**
- * Convert an array to its JSON representation. This is a VERY simple
- * implementation just to support what is needed for the debugger.
- * @param {Array} array The array to format as JSON
+ * Convert an array to its debugger protocol representation. It will convert
+ * each array element to a protocol value.
+ * @param {Array} array The array to format as protocol array.
* @param {MirrorSerializer} mirror_serializer The serializer to use if any
* mirror objects are encountered.
- * @return {string} JSON formatted array value
+ * @return {Array} Protocol array value.
*/
-function SimpleArrayToJSON_(array, mirror_serializer) {
- // Make JSON array representation.
- var json = '[';
+function ArrayToProtocolArray_(array, mirror_serializer) {
+ var json = [];
for (var i = 0; i < array.length; i++) {
- if (i != 0) {
- json += ',';
- }
- var elem = array[i];
- if (elem instanceof Mirror) {
- json += mirror_serializer.serializeValue(elem);
- } else if (IS_OBJECT(elem)) {
- json += SimpleObjectToJSON_(elem);
- } else if (IS_BOOLEAN(elem)) {
- json += BooleanToJSON_(elem);
- } else if (IS_NUMBER(elem)) {
- json += NumberToJSON_(elem);
- } else if (IS_STRING(elem)) {
- json += StringToJSON_(elem);
- } else {
- json += elem;
- }
+ json.push(ValueToProtocolValue_(array[i], mirror_serializer));
+ }
+ return json;
+}
+
+
+/**
+ * Convert a value to its debugger protocol representation.
+ * @param {*} value The value to format as protocol value.
+ * @param {MirrorSerializer} mirror_serializer The serializer to use if any
+ * mirror objects are encountered.
+ * @return {*} Protocol value.
+ */
+function ValueToProtocolValue_(value, mirror_serializer) {
+ // Format the value based on its type.
+ var json;
+ switch (typeof value) {
+ case 'object':
+ if (value instanceof Mirror) {
+ json = mirror_serializer.serializeValue(value);
+ } else if (IS_ARRAY(value)){
+ json = ArrayToProtocolArray_(value, mirror_serializer);
+ } else {
+ json = ObjectToProtocolObject_(value, mirror_serializer);
+ }
+ break;
+
+ case 'boolean':
+ case 'string':
+ case 'number':
+ json = value;
+ break
+
+ default:
+ json = null;
}
- json += ']';
return json;
}
// Touch the RegExp and Date functions to make sure that date-delay.js and
// regexp-delay.js has been loaded. This is required as the mirrors use
-// functions within these files through the builtins object. See the
-// function DateToISO8601_ as an example.
+// functions within these files through the builtins object.
RegExp;
Date;
DateMirror.prototype.toText = function() {
- return DateToISO8601_(this.value_);
+ var s = JSON.stringify(this.value_);
+ return s.substring(1, s.length - 1); // cut quotes
}
/**
* Returns a serialization of all the objects referenced.
*
- * @param {Mirror} mirror The mirror to serialize
- * @returns {String} JSON serialization
+ * @param {Mirror} mirror The mirror to serialize.
+ * @returns {Array.<Object>} Array of the referenced objects converted to
+ * protcol objects.
*/
JSONProtocolSerializer.prototype.serializeReferencedObjects = function() {
- // Collect the JSON serialization of the referenced objects in an array.
- var content = new Array();
+ // Collect the protocol representation of the referenced objects in an array.
+ var content = [];
// Get the number of referenced objects.
var count = this.mirrors_.length;
content.push(this.serialize_(this.mirrors_[i], false, false));
}
- var json = ArrayToJSONArray_(content);
- return json;
+ return content;
}
if (reference &&
(mirror.isValue() || mirror.isScript() || mirror.isContext())) {
this.add_(mirror);
- return '{"ref":' + mirror.handle() + '}';
+ return {'ref' : mirror.handle()};
}
- // Collect the JSON property/value pairs in an array.
- var content = new Array();
+ // Collect the JSON property/value pairs.
+ var content = {};
// Add the mirror handle.
if (mirror.isValue() || mirror.isScript() || mirror.isContext()) {
- content.push(MakeJSONPair_('handle', NumberToJSON_(mirror.handle())));
+ content.handle = mirror.handle();
}
// Always add the type.
- content.push(MakeJSONPair_('type', StringToJSON_(mirror.type())));
+ content.type = mirror.type();
switch (mirror.type()) {
case UNDEFINED_TYPE:
case BOOLEAN_TYPE:
// Boolean values are simply represented by their value.
- content.push(MakeJSONPair_('value', BooleanToJSON_(mirror.value())));
+ content.value = mirror.value();
break;
case NUMBER_TYPE:
// Number values are simply represented by their value.
- content.push(MakeJSONPair_('value', NumberToJSON_(mirror.value())));
+ content.value = NumberToJSON_(mirror.value());
break;
case STRING_TYPE:
// String values might have their value cropped to keep down size.
if (mirror.length() > kMaxProtocolStringLength) {
var str = mirror.value().substring(0, kMaxProtocolStringLength);
- content.push(MakeJSONPair_('value', StringToJSON_(str)));
- content.push(MakeJSONPair_('fromIndex', NumberToJSON_(0)));
- content.push(MakeJSONPair_('toIndex',
- NumberToJSON_(kMaxProtocolStringLength)));
+ content.value = str;
+ content.fromIndex = 0;
+ content.toIndex = kMaxProtocolStringLength;
} else {
- content.push(MakeJSONPair_('value', StringToJSON_(mirror.value())));
+ content.value = mirror.value();
}
- content.push(MakeJSONPair_('length', NumberToJSON_(mirror.length())));
+ content.length = mirror.length();
break;
case OBJECT_TYPE:
case SCRIPT_TYPE:
// Script is represented by id, name and source attributes.
if (mirror.name()) {
- content.push(MakeJSONPair_('name', StringToJSON_(mirror.name())));
+ content.name = mirror.name();
}
- content.push(MakeJSONPair_('id', NumberToJSON_(mirror.id())));
- content.push(MakeJSONPair_('lineOffset',
- NumberToJSON_(mirror.lineOffset())));
- content.push(MakeJSONPair_('columnOffset',
- NumberToJSON_(mirror.columnOffset())));
- content.push(MakeJSONPair_('lineCount',
- NumberToJSON_(mirror.lineCount())));
+ content.id = mirror.id();
+ content.lineOffset = mirror.lineOffset();
+ content.columnOffset = mirror.columnOffset();
+ content.lineCount = mirror.lineCount();
if (mirror.data()) {
- content.push(MakeJSONPair_('data', JSON.stringify(mirror.data())));
+ content.data = mirror.data();
}
if (this.includeSource_()) {
- content.push(MakeJSONPair_('source',
- StringToJSON_(mirror.source())));
+ content.source = mirror.source();
} else {
var sourceStart = mirror.source().substring(0, 80);
- content.push(MakeJSONPair_('sourceStart',
- StringToJSON_(sourceStart)));
+ content.sourceStart = sourceStart;
}
- content.push(MakeJSONPair_('sourceLength',
- NumberToJSON_(mirror.source().length)));
- content.push(MakeJSONPair_('scriptType',
- NumberToJSON_(mirror.scriptType())));
+ content.sourceLength = mirror.source().length;
+ content.scriptType = mirror.scriptType();
if (mirror.context()) {
- content.push(MakeJSONPair_('context',
- this.serializeReference(mirror.context())));
+ content.context = this.serializeReference(mirror.context());
}
break;
case CONTEXT_TYPE:
- content.push(MakeJSONPair_('data', JSON.stringify(mirror.data())));
+ content.data = mirror.data();
break;
}
// Always add the text representation.
- content.push(MakeJSONPair_('text', StringToJSON_(mirror.toText())));
+ content.text = mirror.toText();
// Create and return the JSON string.
- return ArrayToJSONObject_(content);
+ return content;
}
JSONProtocolSerializer.prototype.serializeObject_ = function(mirror, content,
details) {
// Add general object properties.
- content.push(MakeJSONPair_('className',
- StringToJSON_(mirror.className())));
- content.push(MakeJSONPair_('constructorFunction',
- this.serializeReference(mirror.constructorFunction())));
- content.push(MakeJSONPair_('protoObject',
- this.serializeReference(mirror.protoObject())));
- content.push(MakeJSONPair_('prototypeObject',
- this.serializeReference(mirror.prototypeObject())));
+ content.className = mirror.className();
+ content.constructorFunction =
+ this.serializeReference(mirror.constructorFunction());
+ content.protoObject = this.serializeReference(mirror.protoObject());
+ content.prototypeObject = this.serializeReference(mirror.prototypeObject());
// Add flags to indicate whether there are interceptors.
if (mirror.hasNamedInterceptor()) {
- content.push(MakeJSONPair_('namedInterceptor', BooleanToJSON_(true)));
+ content.namedInterceptor = true;
}
if (mirror.hasIndexedInterceptor()) {
- content.push(MakeJSONPair_('indexedInterceptor', BooleanToJSON_(true)));
+ content.indexedInterceptor = true;
}
// Add function specific properties.
if (mirror.isFunction()) {
// Add function specific properties.
- content.push(MakeJSONPair_('name', StringToJSON_(mirror.name())));
+ content.name = mirror.name();
if (!IS_UNDEFINED(mirror.inferredName())) {
- content.push(MakeJSONPair_('inferredName',
- StringToJSON_(mirror.inferredName())));
+ content.inferredName = mirror.inferredName();
}
- content.push(MakeJSONPair_('resolved', BooleanToJSON_(mirror.resolved())));
+ content.resolved = mirror.resolved();
if (mirror.resolved()) {
- content.push(MakeJSONPair_('source', StringToJSON_(mirror.source())));
+ content.source = mirror.source();
}
if (mirror.script()) {
- content.push(MakeJSONPair_('script', this.serializeReference(mirror.script())));
+ content.script = this.serializeReference(mirror.script());
}
}
// Add date specific properties.
if (mirror.isDate()) {
// Add date specific properties.
- content.push(MakeJSONPair_('value', DateToJSON_(mirror.value())));
+ content.value = mirror.value();
}
// Add actual properties - named properties followed by indexed properties.
var propertyIndexes = mirror.propertyNames(PropertyKind.Indexed);
var p = new Array(propertyNames.length + propertyIndexes.length);
for (var i = 0; i < propertyNames.length; i++) {
- var property_mirror = mirror.property(propertyNames[i]);
- p[i] = this.serializeProperty_(property_mirror);
+ var propertyMirror = mirror.property(propertyNames[i]);
+ p[i] = this.serializeProperty_(propertyMirror);
if (details) {
- this.add_(property_mirror.value());
+ this.add_(propertyMirror.value());
}
}
for (var i = 0; i < propertyIndexes.length; i++) {
- var property_mirror = mirror.property(propertyIndexes[i]);
- p[propertyNames.length + i] = this.serializeProperty_(property_mirror);
+ var propertyMirror = mirror.property(propertyIndexes[i]);
+ p[propertyNames.length + i] = this.serializeProperty_(propertyMirror);
if (details) {
- this.add_(property_mirror.value());
+ this.add_(propertyMirror.value());
}
}
- content.push(MakeJSONPair_('properties', ArrayToJSONArray_(p)));
+ content.properties = p;
}
* {"name":"hello","ref":1}
* {"name":"length","attributes":7,"propertyType":3,"ref":2}
*
- * @param {PropertyMirror} property_mirror The property to serialize
- * @returns {String} JSON serialization
+ * @param {PropertyMirror} propertyMirror The property to serialize.
+ * @returns {Object} Protocol object representing the property.
*/
-JSONProtocolSerializer.prototype.serializeProperty_ = function(property_mirror) {
- var builder = new builtins.StringBuilder();
- builder.add('{"name":');
- builder.add(StringToJSON_(property_mirror.name()));
- if (property_mirror.attributes() != PropertyAttribute.None) {
- builder.add(',"attributes":');
- builder.add(NumberToJSON_(property_mirror.attributes()));
+JSONProtocolSerializer.prototype.serializeProperty_ = function(propertyMirror) {
+ var result = {};
+
+ result.name = propertyMirror.name();
+ if (propertyMirror.attributes() != PropertyAttribute.None) {
+ result.attributes = propertyMirror.attributes();
}
- if (property_mirror.propertyType() != PropertyType.Normal) {
- builder.add(',"propertyType":');
- builder.add(NumberToJSON_(property_mirror.propertyType()));
+ if (propertyMirror.propertyType() != PropertyType.Normal) {
+ result.propertyType = propertyMirror.propertyType();
}
- builder.add(',"ref":');
- builder.add(NumberToJSON_(property_mirror.value().handle()));
- builder.add('}');
- return builder.generate();
+ result.ref = propertyMirror.value().handle();
+ return result;
}
JSONProtocolSerializer.prototype.serializeFrame_ = function(mirror, content) {
- content.push(MakeJSONPair_('index', NumberToJSON_(mirror.index())));
- content.push(MakeJSONPair_('receiver',
- this.serializeReference(mirror.receiver())));
+ content.index = mirror.index();
+ content.receiver = this.serializeReference(mirror.receiver());
var func = mirror.func();
- content.push(MakeJSONPair_('func', this.serializeReference(func)));
+ content.func = this.serializeReference(func);
if (func.script()) {
- content.push(MakeJSONPair_('script',
- this.serializeReference(func.script())));
+ content.script = this.serializeReference(func.script());
}
- content.push(MakeJSONPair_('constructCall',
- BooleanToJSON_(mirror.isConstructCall())));
- content.push(MakeJSONPair_('debuggerFrame',
- BooleanToJSON_(mirror.isDebuggerFrame())));
+ content.constructCall = mirror.isConstructCall();
+ content.debuggerFrame = mirror.isDebuggerFrame();
var x = new Array(mirror.argumentCount());
for (var i = 0; i < mirror.argumentCount(); i++) {
- arg = new Array();
+ var arg = {};
var argument_name = mirror.argumentName(i)
if (argument_name) {
- arg.push(MakeJSONPair_('name', StringToJSON_(argument_name)));
+ arg.name = argument_name;
}
- arg.push(MakeJSONPair_('value',
- this.serializeReference(mirror.argumentValue(i))));
- x[i] = ArrayToJSONObject_(arg);
+ arg.value = this.serializeReference(mirror.argumentValue(i));
+ x[i] = arg;
}
- content.push(MakeJSONPair_('arguments', ArrayToJSONArray_(x)));
+ content.arguments = x;
var x = new Array(mirror.localCount());
for (var i = 0; i < mirror.localCount(); i++) {
- var name = MakeJSONPair_('name', StringToJSON_(mirror.localName(i)));
- var value = MakeJSONPair_('value',
- this.serializeReference(mirror.localValue(i)));
- x[i] = '{' + name + ',' + value + '}';
+ var local = {};
+ local.name = mirror.localName(i);
+ local.value = this.serializeReference(mirror.localValue(i));
+ x[i] = local;
}
- content.push(MakeJSONPair_('locals', ArrayToJSONArray_(x)));
- content.push(MakeJSONPair_('position',
- NumberToJSON_(mirror.sourcePosition())));
+ content.locals = x;
+ content.position = mirror.sourcePosition();
var line = mirror.sourceLine();
if (!IS_UNDEFINED(line)) {
- content.push(MakeJSONPair_('line', NumberToJSON_(line)));
+ content.line = line;
}
var column = mirror.sourceColumn();
if (!IS_UNDEFINED(column)) {
- content.push(MakeJSONPair_('column', NumberToJSON_(column)));
+ content.column = column;
}
var source_line_text = mirror.sourceLineText();
if (!IS_UNDEFINED(source_line_text)) {
- content.push(MakeJSONPair_('sourceLineText',
- StringToJSON_(source_line_text)));
+ content.sourceLineText = source_line_text;
}
}
-function MakeJSONPair_(name, value) {
- return '"' + name + '":' + value;
-}
-
-
-function ArrayToJSONObject_(content) {
- return '{' + content.join(',') + '}';
-}
-
-
-function ArrayToJSONArray_(content) {
- return '[' + content.join(',') + ']';
-}
-
-
-function BooleanToJSON_(value) {
- return String(value);
-}
-
-
/**
- * Convert a number to a JSON string value. For all finite numbers the number
- * literal representation is used. For non finite numbers NaN, Infinite and
+ * Convert a number to a protocol value. For all finite numbers the number
+ * itself is returned. For non finite numbers NaN, Infinite and
* -Infinite the string representation "NaN", "Infinite" or "-Infinite"
- * (including the quotes) is returned.
+ * (not including the quotes) is returned.
*
- * @param {number} value The number value to convert to a JSON value
- * @returns {String} JSON value
+ * @param {number} value The number value to convert to a protocol value.
+ * @returns {number|string} Protocol value.
*/
function NumberToJSON_(value) {
if (isNaN(value)) {
- return '"NaN"';
+ return 'NaN';
}
if (!isFinite(value)) {
if (value > 0) {
- return '"Infinity"';
+ return 'Infinity';
} else {
- return '"-Infinity"';
+ return '-Infinity';
}
}
- return String(value);
-}
-
-
-// Mapping of some control characters to avoid the \uXXXX syntax for most
-// commonly used control cahracters.
-const ctrlCharMap_ = {
- '\b': '\\b',
- '\t': '\\t',
- '\n': '\\n',
- '\f': '\\f',
- '\r': '\\r',
- '"' : '\\"',
- '\\': '\\\\'
-};
-
-
-// Regular expression testing for ", \ and control characters (0x00 - 0x1F).
-const ctrlCharTest_ = new RegExp('["\\\\\x00-\x1F]');
-
-
-// Regular expression matching ", \ and control characters (0x00 - 0x1F)
-// globally.
-const ctrlCharMatch_ = new RegExp('["\\\\\x00-\x1F]', 'g');
-
-
-/**
- * Convert a String to its JSON representation (see http://www.json.org/). To
- * avoid depending on the String object this method calls the functions in
- * string.js directly and not through the value.
- * @param {String} value The String value to format as JSON
- * @return {string} JSON formatted String value
- */
-function StringToJSON_(value) {
- // Check for" , \ and control characters (0x00 - 0x1F). No need to call
- // RegExpTest as ctrlchar is constructed using RegExp.
- if (ctrlCharTest_.test(value)) {
- // Replace ", \ and control characters (0x00 - 0x1F).
- return '"' +
- value.replace(ctrlCharMatch_, function (char) {
- // Use charmap if possible.
- var mapped = ctrlCharMap_[char];
- if (mapped) return mapped;
- mapped = char.charCodeAt();
- // Convert control character to unicode escape sequence.
- return '\\u00' +
- %NumberToRadixString(Math.floor(mapped / 16), 16) +
- %NumberToRadixString(mapped % 16, 16);
- })
- + '"';
- }
-
- // Simple string with no special characters.
- return '"' + value + '"';
-}
-
-
-/**
- * Convert a Date to ISO 8601 format. To avoid depending on the Date object
- * this method calls the functions in date.js directly and not through the
- * value.
- * @param {Date} value The Date value to format as JSON
- * @return {string} JSON formatted Date value
- */
-function DateToISO8601_(value) {
- function f(n) {
- return n < 10 ? '0' + n : n;
- }
- function g(n) {
- return n < 10 ? '00' + n : n < 100 ? '0' + n : n;
- }
- return builtins.GetUTCFullYearFrom(value) + '-' +
- f(builtins.GetUTCMonthFrom(value) + 1) + '-' +
- f(builtins.GetUTCDateFrom(value)) + 'T' +
- f(builtins.GetUTCHoursFrom(value)) + ':' +
- f(builtins.GetUTCMinutesFrom(value)) + ':' +
- f(builtins.GetUTCSecondsFrom(value)) + '.' +
- g(builtins.GetUTCMillisecondsFrom(value)) + 'Z';
-}
-
-/**
- * Convert a Date to ISO 8601 format. To avoid depending on the Date object
- * this method calls the functions in date.js directly and not through the
- * value.
- * @param {Date} value The Date value to format as JSON
- * @return {string} JSON formatted Date value
- */
-function DateToJSON_(value) {
- return '"' + DateToISO8601_(value) + '"';
+ return value;
}