Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(513)

Side by Side Diff: third_party/WebKit/Source/modules/indexeddb/IDBOpenDBRequest.cpp

Issue 2314933005: Align IndexedDB metadata rollback on transaction abort to spec. (Closed)
Patch Set: Rebased. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 DCHECK(m_databaseCallbacks); 94 DCHECK(m_databaseCallbacks);
95 95
96 IDBDatabase* idbDatabase = IDBDatabase::create(getExecutionContext(), std::m ove(backend), m_databaseCallbacks.release()); 96 IDBDatabase* idbDatabase = IDBDatabase::create(getExecutionContext(), std::m ove(backend), m_databaseCallbacks.release());
97 idbDatabase->setMetadata(metadata); 97 idbDatabase->setMetadata(metadata);
98 98
99 if (oldVersion == IDBDatabaseMetadata::NoVersion) { 99 if (oldVersion == IDBDatabaseMetadata::NoVersion) {
100 // This database hasn't had a version before. 100 // This database hasn't had a version before.
101 oldVersion = IDBDatabaseMetadata::DefaultVersion; 101 oldVersion = IDBDatabaseMetadata::DefaultVersion;
102 } 102 }
103 IDBDatabaseMetadata oldMetadata(metadata); 103 IDBDatabaseMetadata oldDatabaseMetadata(metadata.name, metadata.id, oldVersi on, metadata.maxObjectStoreId);
104 oldMetadata.version = oldVersion;
105 104
106 m_transaction = IDBTransaction::createVersionChange(getScriptState(), m_tran sactionId, idbDatabase, this, oldMetadata); 105 m_transaction = IDBTransaction::createVersionChange(getScriptState(), m_tran sactionId, idbDatabase, this, oldDatabaseMetadata);
107 setResult(IDBAny::create(idbDatabase)); 106 setResult(IDBAny::create(idbDatabase));
108 107
109 if (m_version == IDBDatabaseMetadata::NoVersion) 108 if (m_version == IDBDatabaseMetadata::NoVersion)
110 m_version = 1; 109 m_version = 1;
111 enqueueEvent(IDBVersionChangeEvent::create(EventTypeNames::upgradeneeded, ol dVersion, m_version, dataLoss, dataLossMessage)); 110 enqueueEvent(IDBVersionChangeEvent::create(EventTypeNames::upgradeneeded, ol dVersion, m_version, dataLoss, dataLossMessage));
112 } 111 }
113 112
114 void IDBOpenDBRequest::onSuccess(std::unique_ptr<WebIDBDatabase> backend, const IDBDatabaseMetadata& metadata) 113 void IDBOpenDBRequest::onSuccess(std::unique_ptr<WebIDBDatabase> backend, const IDBDatabaseMetadata& metadata)
115 { 114 {
116 IDB_TRACE("IDBOpenDBRequest::onSuccess()"); 115 IDB_TRACE("IDBOpenDBRequest::onSuccess()");
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 dequeueEvent(event); 170 dequeueEvent(event);
172 setResult(nullptr); 171 setResult(nullptr);
173 onError(DOMException::create(AbortError, "The connection was closed.")); 172 onError(DOMException::create(AbortError, "The connection was closed."));
174 return DispatchEventResult::CanceledBeforeDispatch; 173 return DispatchEventResult::CanceledBeforeDispatch;
175 } 174 }
176 175
177 return IDBRequest::dispatchEventInternal(event); 176 return IDBRequest::dispatchEventInternal(event);
178 } 177 }
179 178
180 } // namespace blink 179 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698