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