mirror of
https://github.com/servo/servo.git
synced 2025-09-23 05:10:09 +01:00
indexeddb: Finish implementation of key_type_to_jsval (#39008)
Uses clipped time to convert dates that are stored as `f64`s into JS values. Testing: WPT Fixes: #25327 --------- Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
This commit is contained in:
parent
a1f9e3e133
commit
47551fc6fa
3 changed files with 8 additions and 4 deletions
|
@ -51,9 +51,10 @@ pub fn key_type_to_jsval(
|
|||
IndexedDBKeyType::Number(n) => result.set(DoubleValue(*n)),
|
||||
IndexedDBKeyType::String(s) => s.safe_to_jsval(cx, result),
|
||||
IndexedDBKeyType::Binary(b) => b.safe_to_jsval(cx, result),
|
||||
IndexedDBKeyType::Date(_d) => {
|
||||
// TODO: implement this when Date's representation is finalized.
|
||||
result.set(UndefinedValue());
|
||||
IndexedDBKeyType::Date(d) => {
|
||||
let time = js::jsapi::ClippedTime { t: *d };
|
||||
let date = unsafe { js::jsapi::NewDateObject(*cx, time) };
|
||||
date.safe_to_jsval(cx, result);
|
||||
},
|
||||
IndexedDBKeyType::Array(a) => {
|
||||
rooted_vec!(let mut values <- repeat_n(UndefinedValue(), a.len()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue