OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 return v8::Undefined(isolate); | 151 return v8::Undefined(isolate); |
152 } | 152 } |
153 | 153 |
154 static const size_t maximumDepth = 2000; | 154 static const size_t maximumDepth = 2000; |
155 | 155 |
156 static PassRefPtr<IDBKey> createIDBKeyFromValue(v8::Handle<v8::Value> value, Vec
tor<v8::Handle<v8::Array> >& stack, v8::Isolate* isolate) | 156 static PassRefPtr<IDBKey> createIDBKeyFromValue(v8::Handle<v8::Value> value, Vec
tor<v8::Handle<v8::Array> >& stack, v8::Isolate* isolate) |
157 { | 157 { |
158 if (value->IsNumber() && !std::isnan(value->NumberValue())) | 158 if (value->IsNumber() && !std::isnan(value->NumberValue())) |
159 return IDBKey::createNumber(value->NumberValue()); | 159 return IDBKey::createNumber(value->NumberValue()); |
160 if (value->IsString()) | 160 if (value->IsString()) |
161 return IDBKey::createString(toWebCoreString(value.As<v8::String>())); | 161 return IDBKey::createString(toCoreString(value.As<v8::String>())); |
162 if (value->IsDate() && !std::isnan(value->NumberValue())) | 162 if (value->IsDate() && !std::isnan(value->NumberValue())) |
163 return IDBKey::createDate(value->NumberValue()); | 163 return IDBKey::createDate(value->NumberValue()); |
164 if (value->IsArray()) { | 164 if (value->IsArray()) { |
165 v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(value); | 165 v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(value); |
166 | 166 |
167 if (stack.contains(array)) | 167 if (stack.contains(array)) |
168 return 0; | 168 return 0; |
169 if (stack.size() >= maximumDepth) | 169 if (stack.size() >= maximumDepth) |
170 return 0; | 170 return 0; |
171 stack.append(array); | 171 stack.append(array); |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 | 428 |
429 RefPtr<IDBKey> expectedKey = createIDBKeyFromScriptValueAndKeyPath(state, sc
riptValue, keyPath); | 429 RefPtr<IDBKey> expectedKey = createIDBKeyFromScriptValueAndKeyPath(state, sc
riptValue, keyPath); |
430 ASSERT(!expectedKey || expectedKey->isEqual(key.get())); | 430 ASSERT(!expectedKey || expectedKey->isEqual(key.get())); |
431 | 431 |
432 bool injected = injectV8KeyIntoV8Value(keyValue.v8Value(), scriptValue.v8Val
ue(), keyPath, isolate); | 432 bool injected = injectV8KeyIntoV8Value(keyValue.v8Value(), scriptValue.v8Val
ue(), keyPath, isolate); |
433 ASSERT_UNUSED(injected, injected); | 433 ASSERT_UNUSED(injected, injected); |
434 } | 434 } |
435 #endif | 435 #endif |
436 | 436 |
437 } // namespace WebCore | 437 } // namespace WebCore |
OLD | NEW |