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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 { | 171 { |
172 if (value->IsNumber() && !std::isnan(value->NumberValue())) | 172 if (value->IsNumber() && !std::isnan(value->NumberValue())) |
173 return IDBKey::createNumber(value->NumberValue()); | 173 return IDBKey::createNumber(value->NumberValue()); |
174 if (value->IsString()) | 174 if (value->IsString()) |
175 return IDBKey::createString(toCoreString(value.As<v8::String>())); | 175 return IDBKey::createString(toCoreString(value.As<v8::String>())); |
176 if (value->IsDate() && !std::isnan(value->NumberValue())) | 176 if (value->IsDate() && !std::isnan(value->NumberValue())) |
177 return IDBKey::createDate(value->NumberValue()); | 177 return IDBKey::createDate(value->NumberValue()); |
178 if (value->IsUint8Array() && (allowExperimentalTypes || RuntimeEnabledFeatur
es::indexedDBExperimentalEnabled())) { | 178 if (value->IsUint8Array() && (allowExperimentalTypes || RuntimeEnabledFeatur
es::indexedDBExperimentalEnabled())) { |
179 // Per discussion in https://www.w3.org/Bugs/Public/show_bug.cgi?id=2333
2 the | 179 // Per discussion in https://www.w3.org/Bugs/Public/show_bug.cgi?id=2333
2 the |
180 // input type is constrained to Uint8Array to match the output type. | 180 // input type is constrained to Uint8Array to match the output type. |
181 ArrayBufferView* view = blink::V8ArrayBufferView::toNative(value->ToObje
ct()); | 181 ArrayBufferView* view = blink::V8ArrayBufferView::toImpl(value->ToObject
()); |
182 const char* start = static_cast<const char*>(view->baseAddress()); | 182 const char* start = static_cast<const char*>(view->baseAddress()); |
183 size_t length = view->byteLength(); | 183 size_t length = view->byteLength(); |
184 return IDBKey::createBinary(SharedBuffer::create(start, length)); | 184 return IDBKey::createBinary(SharedBuffer::create(start, length)); |
185 } | 185 } |
186 if (value->IsArray()) { | 186 if (value->IsArray()) { |
187 v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(value); | 187 v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(value); |
188 | 188 |
189 if (stack.contains(array)) | 189 if (stack.contains(array)) |
190 return 0; | 190 return 0; |
191 if (stack.size() >= maximumDepth) | 191 if (stack.size() >= maximumDepth) |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 ASSERT(isolate->InContext()); | 421 ASSERT(isolate->InContext()); |
422 v8::HandleScope handleScope(isolate); | 422 v8::HandleScope handleScope(isolate); |
423 v8::Handle<v8::Value> v8Value(scriptValue.v8Value()); | 423 v8::Handle<v8::Value> v8Value(scriptValue.v8Value()); |
424 return createIDBKeyFromValue(isolate, v8Value); | 424 return createIDBKeyFromValue(isolate, v8Value); |
425 } | 425 } |
426 | 426 |
427 IDBKeyRange* scriptValueToIDBKeyRange(v8::Isolate* isolate, const ScriptValue& s
criptValue) | 427 IDBKeyRange* scriptValueToIDBKeyRange(v8::Isolate* isolate, const ScriptValue& s
criptValue) |
428 { | 428 { |
429 v8::HandleScope handleScope(isolate); | 429 v8::HandleScope handleScope(isolate); |
430 v8::Handle<v8::Value> value(scriptValue.v8Value()); | 430 v8::Handle<v8::Value> value(scriptValue.v8Value()); |
431 return V8IDBKeyRange::toNativeWithTypeCheck(isolate, value); | 431 return V8IDBKeyRange::toImplWithTypeCheck(isolate, value); |
432 } | 432 } |
433 | 433 |
434 ScriptValue deserializeScriptValue(ScriptState* scriptState, SerializedScriptVal
ue* serializedValue, const Vector<blink::WebBlobInfo>* blobInfo) | 434 ScriptValue deserializeScriptValue(ScriptState* scriptState, SerializedScriptVal
ue* serializedValue, const Vector<blink::WebBlobInfo>* blobInfo) |
435 { | 435 { |
436 v8::Isolate* isolate = scriptState->isolate(); | 436 v8::Isolate* isolate = scriptState->isolate(); |
437 v8::HandleScope handleScope(isolate); | 437 v8::HandleScope handleScope(isolate); |
438 if (serializedValue) | 438 if (serializedValue) |
439 return ScriptValue(scriptState, serializedValue->deserialize(isolate, 0,
blobInfo)); | 439 return ScriptValue(scriptState, serializedValue->deserialize(isolate, 0,
blobInfo)); |
440 return ScriptValue(scriptState, v8::Null(isolate)); | 440 return ScriptValue(scriptState, v8::Null(isolate)); |
441 } | 441 } |
(...skipping 10 matching lines...) Expand all Loading... |
452 const bool allowExperimentalTypes = true; | 452 const bool allowExperimentalTypes = true; |
453 IDBKey* expectedKey = createIDBKeyFromScriptValueAndKeyPathInternal(isolate,
scriptValue, keyPath, allowExperimentalTypes); | 453 IDBKey* expectedKey = createIDBKeyFromScriptValueAndKeyPathInternal(isolate,
scriptValue, keyPath, allowExperimentalTypes); |
454 ASSERT(!expectedKey || expectedKey->isEqual(key)); | 454 ASSERT(!expectedKey || expectedKey->isEqual(key)); |
455 | 455 |
456 bool injected = injectV8KeyIntoV8Value(isolate, keyValue.v8Value(), scriptVa
lue.v8Value(), keyPath); | 456 bool injected = injectV8KeyIntoV8Value(isolate, keyValue.v8Value(), scriptVa
lue.v8Value(), keyPath); |
457 ASSERT_UNUSED(injected, injected); | 457 ASSERT_UNUSED(injected, injected); |
458 } | 458 } |
459 #endif | 459 #endif |
460 | 460 |
461 } // namespace blink | 461 } // namespace blink |
OLD | NEW |