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

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

Issue 235493003: deleteDatabase() success should be IDBVersionChangeEvent [Blink] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove tests for landing Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « Source/modules/indexeddb/IDBOpenDBRequest.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 } else { 128 } else {
129 ASSERT(backend.get()); 129 ASSERT(backend.get());
130 ASSERT(m_databaseCallbacks); 130 ASSERT(m_databaseCallbacks);
131 idbDatabase = IDBDatabase::create(executionContext(), backend, m_databas eCallbacks.release()); 131 idbDatabase = IDBDatabase::create(executionContext(), backend, m_databas eCallbacks.release());
132 setResult(IDBAny::create(idbDatabase.get())); 132 setResult(IDBAny::create(idbDatabase.get()));
133 } 133 }
134 idbDatabase->setMetadata(metadata); 134 idbDatabase->setMetadata(metadata);
135 enqueueEvent(Event::create(EventTypeNames::success)); 135 enqueueEvent(Event::create(EventTypeNames::success));
136 } 136 }
137 137
138 void IDBOpenDBRequest::onSuccess(int64_t oldVersion)
139 {
140 IDB_TRACE("IDBOpenDBRequest::onSuccess()");
141 if (!shouldEnqueueEvent())
142 return;
143 if (oldVersion == IDBDatabaseMetadata::NoIntVersion) {
144 // This database hasn't had an integer version before.
145 oldVersion = IDBDatabaseMetadata::DefaultIntVersion;
146 }
147 setResult(IDBAny::createUndefined());
148 enqueueEvent(IDBVersionChangeEvent::create(EventTypeNames::success, oldVersi on, Nullable<unsigned long long>()));
149 }
150
138 bool IDBOpenDBRequest::shouldEnqueueEvent() const 151 bool IDBOpenDBRequest::shouldEnqueueEvent() const
139 { 152 {
140 if (m_contextStopped || !executionContext()) 153 if (m_contextStopped || !executionContext())
141 return false; 154 return false;
142 ASSERT(m_readyState == PENDING || m_readyState == DONE); 155 ASSERT(m_readyState == PENDING || m_readyState == DONE);
143 if (m_requestAborted) 156 if (m_requestAborted)
144 return false; 157 return false;
145 return true; 158 return true;
146 } 159 }
147 160
148 bool IDBOpenDBRequest::dispatchEvent(PassRefPtrWillBeRawPtr<Event> event) 161 bool IDBOpenDBRequest::dispatchEvent(PassRefPtrWillBeRawPtr<Event> event)
149 { 162 {
150 // If the connection closed between onUpgradeNeeded and the delivery of the "success" event, 163 // If the connection closed between onUpgradeNeeded and the delivery of the "success" event,
151 // an "error" event should be fired instead. 164 // an "error" event should be fired instead.
152 if (event->type() == EventTypeNames::success && resultAsAny()->type() == IDB Any::IDBDatabaseType && resultAsAny()->idbDatabase()->isClosePending()) { 165 if (event->type() == EventTypeNames::success && resultAsAny()->type() == IDB Any::IDBDatabaseType && resultAsAny()->idbDatabase()->isClosePending()) {
153 dequeueEvent(event.get()); 166 dequeueEvent(event.get());
154 setResult(nullptr); 167 setResult(nullptr);
155 onError(DOMError::create(AbortError, "The connection was closed.")); 168 onError(DOMError::create(AbortError, "The connection was closed."));
156 return false; 169 return false;
157 } 170 }
158 171
159 return IDBRequest::dispatchEvent(event); 172 return IDBRequest::dispatchEvent(event);
160 } 173 }
161 174
162 } // namespace WebCore 175 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/indexeddb/IDBOpenDBRequest.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698