| 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 { | 190 { |
| 191 if (value->IsNumber() && !std::isnan(value.As<v8::Number>()->Value())) | 191 if (value->IsNumber() && !std::isnan(value.As<v8::Number>()->Value())) |
| 192 return IDBKey::createNumber(value.As<v8::Number>()->Value()); | 192 return IDBKey::createNumber(value.As<v8::Number>()->Value()); |
| 193 if (value->IsString()) | 193 if (value->IsString()) |
| 194 return IDBKey::createString(toCoreString(value.As<v8::String>())); | 194 return IDBKey::createString(toCoreString(value.As<v8::String>())); |
| 195 if (value->IsDate() && !std::isnan(value.As<v8::Date>()->ValueOf())) | 195 if (value->IsDate() && !std::isnan(value.As<v8::Date>()->ValueOf())) |
| 196 return IDBKey::createDate(value.As<v8::Date>()->ValueOf()); | 196 return IDBKey::createDate(value.As<v8::Date>()->ValueOf()); |
| 197 if (value->IsUint8Array() && (allowExperimentalTypes || RuntimeEnabledFeatur
es::indexedDBExperimentalEnabled())) { | 197 if (value->IsUint8Array() && (allowExperimentalTypes || RuntimeEnabledFeatur
es::indexedDBExperimentalEnabled())) { |
| 198 // Per discussion in https://www.w3.org/Bugs/Public/show_bug.cgi?id=2333
2 the | 198 // Per discussion in https://www.w3.org/Bugs/Public/show_bug.cgi?id=2333
2 the |
| 199 // input type is constrained to Uint8Array to match the output type. | 199 // input type is constrained to Uint8Array to match the output type. |
| 200 DOMArrayBufferView* view = blink::V8ArrayBufferView::toImpl(value.As<v8:
:Object>()); | 200 DOMArrayBufferView* view = V8ArrayBufferView::toImpl(value.As<v8::Object
>()); |
| 201 const char* start = static_cast<const char*>(view->baseAddress()); | 201 const char* start = static_cast<const char*>(view->baseAddress()); |
| 202 size_t length = view->byteLength(); | 202 size_t length = view->byteLength(); |
| 203 return IDBKey::createBinary(SharedBuffer::create(start, length)); | 203 return IDBKey::createBinary(SharedBuffer::create(start, length)); |
| 204 } | 204 } |
| 205 if (value->IsArray()) { | 205 if (value->IsArray()) { |
| 206 v8::Local<v8::Array> array = value.As<v8::Array>(); | 206 v8::Local<v8::Array> array = value.As<v8::Array>(); |
| 207 | 207 |
| 208 if (stack.contains(array)) | 208 if (stack.contains(array)) |
| 209 return nullptr; | 209 return nullptr; |
| 210 if (stack.size() >= maximumDepth) | 210 if (stack.size() >= maximumDepth) |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 return false; | 425 return false; |
| 426 if (!hasOwnProperty) | 426 if (!hasOwnProperty) |
| 427 return true; | 427 return true; |
| 428 // Otherwise, get it and keep traversing. | 428 // Otherwise, get it and keep traversing. |
| 429 if (!object->Get(context, property).ToLocal(¤t)) | 429 if (!object->Get(context, property).ToLocal(¤t)) |
| 430 return false; | 430 return false; |
| 431 } | 431 } |
| 432 return true; | 432 return true; |
| 433 } | 433 } |
| 434 | 434 |
| 435 ScriptValue deserializeScriptValue(ScriptState* scriptState, SerializedScriptVal
ue* serializedValue, const Vector<blink::WebBlobInfo>* blobInfo) | 435 ScriptValue deserializeScriptValue(ScriptState* scriptState, SerializedScriptVal
ue* serializedValue, const Vector<WebBlobInfo>* blobInfo) |
| 436 { | 436 { |
| 437 v8::Isolate* isolate = scriptState->isolate(); | 437 v8::Isolate* isolate = scriptState->isolate(); |
| 438 v8::HandleScope handleScope(isolate); | 438 v8::HandleScope handleScope(isolate); |
| 439 if (serializedValue) | 439 if (serializedValue) |
| 440 return ScriptValue(scriptState, serializedValue->deserialize(isolate, nu
llptr, blobInfo)); | 440 return ScriptValue(scriptState, serializedValue->deserialize(isolate, nu
llptr, blobInfo)); |
| 441 return ScriptValue(scriptState, v8::Null(isolate)); | 441 return ScriptValue(scriptState, v8::Null(isolate)); |
| 442 } | 442 } |
| 443 | 443 |
| 444 SQLValue NativeValueTraits<SQLValue>::nativeValue(v8::Isolate* isolate, v8::Loca
l<v8::Value> value, ExceptionState& exceptionState) | 444 SQLValue NativeValueTraits<SQLValue>::nativeValue(v8::Isolate* isolate, v8::Loca
l<v8::Value> value, ExceptionState& exceptionState) |
| 445 { | 445 { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 IDBKey* expectedKey = createIDBKeyFromValueAndKeyPath(isolate, scriptValue.v
8Value(), value->keyPath(), allowExperimentalTypes); | 486 IDBKey* expectedKey = createIDBKeyFromValueAndKeyPath(isolate, scriptValue.v
8Value(), value->keyPath(), allowExperimentalTypes); |
| 487 if (expectedKey && expectedKey->isEqual(value->primaryKey())) | 487 if (expectedKey && expectedKey->isEqual(value->primaryKey())) |
| 488 return; | 488 return; |
| 489 | 489 |
| 490 bool injected = injectV8KeyIntoV8Value(isolate, keyValue.v8Value(), scriptVa
lue.v8Value(), value->keyPath()); | 490 bool injected = injectV8KeyIntoV8Value(isolate, keyValue.v8Value(), scriptVa
lue.v8Value(), value->keyPath()); |
| 491 ASSERT_UNUSED(injected, injected); | 491 ASSERT_UNUSED(injected, injected); |
| 492 } | 492 } |
| 493 #endif | 493 #endif |
| 494 | 494 |
| 495 } // namespace blink | 495 } // namespace blink |
| OLD | NEW |