Chromium Code Reviews| Index: src/date.js |
| diff --git a/src/date.js b/src/date.js |
| index 960147072c27cca7d690fe8beba71d64dffc7ea0..cdc35cbb720a71a4b8ca875bf78b2631fdf402a9 100644 |
| --- a/src/date.js |
| +++ b/src/date.js |
| @@ -992,6 +992,13 @@ function DateToISOString() { |
| } |
| +function CheckJSONPrimitive(val) { |
| + if (!IsPrimitive(val)) |
| + throw MakeTypeError('result_not_primitive', ['toJSON', val]); |
| + return val; |
| +} |
| + |
| + |
| function DateToJSON(key) { |
| return CheckJSONPrimitive(this.toISOString()); |
|
Rico
2010/12/15 07:46:10
Two things;
1. If "this" is a custom object, and i
Lasse Reichstein
2010/12/15 08:59:54
Rewritten completely, CheckJSONPrimitive removed a
|
| } |