| 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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 v8::HandleScope handleScope(isolate); | 429 v8::HandleScope handleScope(isolate); |
| 430 v8::Handle<v8::Value> v8Value(scriptValue.v8Value()); | 430 v8::Handle<v8::Value> v8Value(scriptValue.v8Value()); |
| 431 return createIDBKeyFromValue(v8Value, isolate); | 431 return createIDBKeyFromValue(v8Value, isolate); |
| 432 } | 432 } |
| 433 | 433 |
| 434 PassRefPtr<IDBKeyRange> scriptValueToIDBKeyRange(DOMRequestState* state, const S
criptValue& scriptValue) | 434 PassRefPtr<IDBKeyRange> scriptValueToIDBKeyRange(DOMRequestState* state, const S
criptValue& scriptValue) |
| 435 { | 435 { |
| 436 v8::Isolate* isolate = state ? state->context()->GetIsolate() : v8::Isolate:
:GetCurrent(); | 436 v8::Isolate* isolate = state ? state->context()->GetIsolate() : v8::Isolate:
:GetCurrent(); |
| 437 v8::HandleScope handleScope(isolate); | 437 v8::HandleScope handleScope(isolate); |
| 438 v8::Handle<v8::Value> value(scriptValue.v8Value()); | 438 v8::Handle<v8::Value> value(scriptValue.v8Value()); |
| 439 if (V8IDBKeyRange::hasInstance(value, isolate)) | 439 return V8IDBKeyRange::toNativeWithTypeCheck(isolate, value); |
| 440 return V8IDBKeyRange::toNative(value.As<v8::Object>()); | |
| 441 return 0; | |
| 442 } | 440 } |
| 443 | 441 |
| 444 #ifndef NDEBUG | 442 #ifndef NDEBUG |
| 445 void assertPrimaryKeyValidOrInjectable(DOMRequestState* state, PassRefPtr<Shared
Buffer> buffer, PassRefPtr<IDBKey> prpKey, const IDBKeyPath& keyPath) | 443 void assertPrimaryKeyValidOrInjectable(DOMRequestState* state, PassRefPtr<Shared
Buffer> buffer, PassRefPtr<IDBKey> prpKey, const IDBKeyPath& keyPath) |
| 446 { | 444 { |
| 447 RefPtr<IDBKey> key(prpKey); | 445 RefPtr<IDBKey> key(prpKey); |
| 448 | 446 |
| 449 DOMRequestState::Scope scope(*state); | 447 DOMRequestState::Scope scope(*state); |
| 450 v8::Isolate* isolate = state ? state->context()->GetIsolate() : v8::Isolate:
:GetCurrent(); | 448 v8::Isolate* isolate = state ? state->context()->GetIsolate() : v8::Isolate:
:GetCurrent(); |
| 451 | 449 |
| 452 ScriptValue keyValue = idbKeyToScriptValue(state, key); | 450 ScriptValue keyValue = idbKeyToScriptValue(state, key); |
| 453 ScriptValue scriptValue(deserializeIDBValueBuffer(buffer.get(), isolate), is
olate); | 451 ScriptValue scriptValue(deserializeIDBValueBuffer(buffer.get(), isolate), is
olate); |
| 454 | 452 |
| 455 // This assertion is about already persisted data, so allow experimental typ
es. | 453 // This assertion is about already persisted data, so allow experimental typ
es. |
| 456 const bool allowExperimentalTypes = true; | 454 const bool allowExperimentalTypes = true; |
| 457 RefPtr<IDBKey> expectedKey = createIDBKeyFromScriptValueAndKeyPath(scriptVal
ue, keyPath, isolate, allowExperimentalTypes); | 455 RefPtr<IDBKey> expectedKey = createIDBKeyFromScriptValueAndKeyPath(scriptVal
ue, keyPath, isolate, allowExperimentalTypes); |
| 458 ASSERT(!expectedKey || expectedKey->isEqual(key.get())); | 456 ASSERT(!expectedKey || expectedKey->isEqual(key.get())); |
| 459 | 457 |
| 460 bool injected = injectV8KeyIntoV8Value(keyValue.v8Value(), scriptValue.v8Val
ue(), keyPath, isolate); | 458 bool injected = injectV8KeyIntoV8Value(keyValue.v8Value(), scriptValue.v8Val
ue(), keyPath, isolate); |
| 461 ASSERT_UNUSED(injected, injected); | 459 ASSERT_UNUSED(injected, injected); |
| 462 } | 460 } |
| 463 #endif | 461 #endif |
| 464 | 462 |
| 465 } // namespace WebCore | 463 } // namespace WebCore |
| OLD | NEW |