| 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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 exceptionState); | 587 exceptionState); |
| 588 } | 588 } |
| 589 | 589 |
| 590 IDBKeyRange* NativeValueTraits<IDBKeyRange*>::nativeValue( | 590 IDBKeyRange* NativeValueTraits<IDBKeyRange*>::nativeValue( |
| 591 v8::Isolate* isolate, | 591 v8::Isolate* isolate, |
| 592 v8::Local<v8::Value> value, | 592 v8::Local<v8::Value> value, |
| 593 ExceptionState& exceptionState) { | 593 ExceptionState& exceptionState) { |
| 594 return V8IDBKeyRange::toImplWithTypeCheck(isolate, value); | 594 return V8IDBKeyRange::toImplWithTypeCheck(isolate, value); |
| 595 } | 595 } |
| 596 | 596 |
| 597 #if ENABLE(ASSERT) | 597 #if DCHECK_IS_ON() |
| 598 // This assertion is used when a value has been retrieved from an object store | 598 // This assertion is used when a value has been retrieved from an object store |
| 599 // with implicit keys (i.e. a key path). It verifies that either the value | 599 // with implicit keys (i.e. a key path). It verifies that either the value |
| 600 // contains an implicit key matching the primary key (so it was correctly | 600 // contains an implicit key matching the primary key (so it was correctly |
| 601 // extracted when stored) or that the key can be inserted as an own property. | 601 // extracted when stored) or that the key can be inserted as an own property. |
| 602 void assertPrimaryKeyValidOrInjectable(ScriptState* scriptState, | 602 void assertPrimaryKeyValidOrInjectable(ScriptState* scriptState, |
| 603 const IDBValue* value) { | 603 const IDBValue* value) { |
| 604 ScriptState::Scope scope(scriptState); | 604 ScriptState::Scope scope(scriptState); |
| 605 v8::Isolate* isolate = scriptState->isolate(); | 605 v8::Isolate* isolate = scriptState->isolate(); |
| 606 ScriptValue keyValue = ScriptValue::from(scriptState, value->primaryKey()); | 606 ScriptValue keyValue = ScriptValue::from(scriptState, value->primaryKey()); |
| 607 ScriptValue scriptValue(scriptState, deserializeIDBValueData(isolate, value)); | 607 ScriptValue scriptValue(scriptState, deserializeIDBValueData(isolate, value)); |
| 608 | 608 |
| 609 // This assertion is about already persisted data, so allow experimental | 609 // This assertion is about already persisted data, so allow experimental |
| 610 // types. | 610 // types. |
| 611 const bool allowExperimentalTypes = true; | 611 const bool allowExperimentalTypes = true; |
| 612 DummyExceptionStateForTesting exceptionState; | 612 DummyExceptionStateForTesting exceptionState; |
| 613 IDBKey* expectedKey = createIDBKeyFromValueAndKeyPath( | 613 IDBKey* expectedKey = createIDBKeyFromValueAndKeyPath( |
| 614 isolate, scriptValue.v8Value(), value->keyPath(), exceptionState, | 614 isolate, scriptValue.v8Value(), value->keyPath(), exceptionState, |
| 615 allowExperimentalTypes); | 615 allowExperimentalTypes); |
| 616 ASSERT(!exceptionState.hadException()); | 616 ASSERT(!exceptionState.hadException()); |
| 617 if (expectedKey && expectedKey->isEqual(value->primaryKey())) | 617 if (expectedKey && expectedKey->isEqual(value->primaryKey())) |
| 618 return; | 618 return; |
| 619 | 619 |
| 620 bool injected = injectV8KeyIntoV8Value( | 620 bool injected = injectV8KeyIntoV8Value( |
| 621 isolate, keyValue.v8Value(), scriptValue.v8Value(), value->keyPath()); | 621 isolate, keyValue.v8Value(), scriptValue.v8Value(), value->keyPath()); |
| 622 DCHECK(injected); | 622 DCHECK(injected); |
| 623 } | 623 } |
| 624 #endif | 624 #endif |
| 625 | 625 |
| 626 } // namespace blink | 626 } // namespace blink |
| OLD | NEW |