Bug 1050340 - Handle dates generically. r=luke

This commit is contained in:
Bobby Holley
2014-08-18 14:18:38 -07:00
parent 5adb6a163c
commit 538d06df6f
2 changed files with 6 additions and 2 deletions

View File

@@ -32,6 +32,7 @@
#include "jsstr.h"
#include "jstypes.h"
#include "jsutil.h"
#include "jswrapper.h"
#include "prmjtime.h"
#include "js/Date.h"
@@ -3130,5 +3131,8 @@ js_DateGetSeconds(JSObject *obj)
JS_FRIEND_API(double)
js_DateGetMsecSinceEpoch(JSObject *obj)
{
return obj->is<DateObject>() ? obj->as<DateObject>().UTCTime().toNumber() : 0;
obj = CheckedUnwrap(obj);
if (!obj || !obj->is<DateObject>())
return 0;
return obj->as<DateObject>().UTCTime().toNumber();
}