OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 return ScriptValue::from(scriptState, m_primaryKey); | 314 return ScriptValue::from(scriptState, m_primaryKey); |
315 } | 315 } |
316 | 316 |
317 ScriptValue IDBCursor::value(ScriptState* scriptState) | 317 ScriptValue IDBCursor::value(ScriptState* scriptState) |
318 { | 318 { |
319 ASSERT(isCursorWithValue()); | 319 ASSERT(isCursorWithValue()); |
320 | 320 |
321 IDBObjectStore* objectStore = effectiveObjectStore(); | 321 IDBObjectStore* objectStore = effectiveObjectStore(); |
322 const IDBObjectStoreMetadata& metadata = objectStore->metadata(); | 322 const IDBObjectStoreMetadata& metadata = objectStore->metadata(); |
323 IDBAny* value; | 323 IDBAny* value; |
324 if (metadata.autoIncrement && !metadata.keyPath.isNull()) { | 324 if (!m_value) { |
| 325 value = IDBAny::createUndefined(); |
| 326 } else if (metadata.autoIncrement && !metadata.keyPath.isNull()) { |
325 RefPtr<IDBValue> idbValue = IDBValue::create(m_value.get(), m_primaryKey
, metadata.keyPath); | 327 RefPtr<IDBValue> idbValue = IDBValue::create(m_value.get(), m_primaryKey
, metadata.keyPath); |
326 #if ENABLE(ASSERT) | 328 #if ENABLE(ASSERT) |
327 assertPrimaryKeyValidOrInjectable(scriptState, idbValue.get()); | 329 assertPrimaryKeyValidOrInjectable(scriptState, idbValue.get()); |
328 #endif | 330 #endif |
329 value = IDBAny::create(idbValue.release()); | 331 value = IDBAny::create(idbValue.release()); |
330 } else { | 332 } else { |
331 value = IDBAny::create(m_value); | 333 value = IDBAny::create(m_value); |
332 } | 334 } |
333 | 335 |
334 m_valueDirty = false; | 336 m_valueDirty = false; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 case WebIDBCursorDirectionPrevNoDuplicate: | 403 case WebIDBCursorDirectionPrevNoDuplicate: |
402 return IndexedDBNames::prevunique; | 404 return IndexedDBNames::prevunique; |
403 | 405 |
404 default: | 406 default: |
405 ASSERT_NOT_REACHED(); | 407 ASSERT_NOT_REACHED(); |
406 return IndexedDBNames::next; | 408 return IndexedDBNames::next; |
407 } | 409 } |
408 } | 410 } |
409 | 411 |
410 } // namespace blink | 412 } // namespace blink |
OLD | NEW |