/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
#include "IDBKey.h"
#include "V8Binding.h"
+#include <wtf/Vector.h>
+
namespace WebCore {
v8::Handle<v8::Value> toV8(IDBKey* key)
return v8::Null();
switch (key->type()) {
- case IDBKey::NullType:
- return v8::Null();
+ case IDBKey::InvalidType:
+ case IDBKey::MinType:
+ ASSERT_NOT_REACHED();
+ return v8::Undefined();
case IDBKey::NumberType:
return v8::Number::New(key->number());
case IDBKey::StringType:
return v8String(key->string());
case IDBKey::DateType:
return v8::Date::New(key->date());
+ case IDBKey::ArrayType:
+ {
+ v8::Local<v8::Array> array = v8::Array::New(key->array().size());
+ for (size_t i = 0; i < key->array().size(); ++i)
+ array->Set(i, toV8(key->array()[i].get()));
+ return array;
+ }
}
ASSERT_NOT_REACHED();