OLD | NEW |
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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 bool IDBOpenDBRequest::shouldEnqueueEvent() const { | 168 bool IDBOpenDBRequest::shouldEnqueueEvent() const { |
169 if (m_contextStopped || !getExecutionContext()) | 169 if (m_contextStopped || !getExecutionContext()) |
170 return false; | 170 return false; |
171 DCHECK(m_readyState == PENDING || m_readyState == DONE); | 171 DCHECK(m_readyState == PENDING || m_readyState == DONE); |
172 if (m_requestAborted) | 172 if (m_requestAborted) |
173 return false; | 173 return false; |
174 return true; | 174 return true; |
175 } | 175 } |
176 | 176 |
177 DispatchEventResult IDBOpenDBRequest::dispatchEventInternal(Event* event) { | 177 DispatchEventResult IDBOpenDBRequest::dispatchEventInternal(Event* event) { |
178 // If the connection closed between onUpgradeNeeded and the delivery of the "s
uccess" event, | 178 // If the connection closed between onUpgradeNeeded and the delivery of the |
179 // an "error" event should be fired instead. | 179 // "success" event, an "error" event should be fired instead. |
180 if (event->type() == EventTypeNames::success && | 180 if (event->type() == EventTypeNames::success && |
181 resultAsAny()->getType() == IDBAny::IDBDatabaseType && | 181 resultAsAny()->getType() == IDBAny::IDBDatabaseType && |
182 resultAsAny()->idbDatabase()->isClosePending()) { | 182 resultAsAny()->idbDatabase()->isClosePending()) { |
183 dequeueEvent(event); | 183 dequeueEvent(event); |
184 setResult(nullptr); | 184 setResult(nullptr); |
185 onError(DOMException::create(AbortError, "The connection was closed.")); | 185 onError(DOMException::create(AbortError, "The connection was closed.")); |
186 return DispatchEventResult::CanceledBeforeDispatch; | 186 return DispatchEventResult::CanceledBeforeDispatch; |
187 } | 187 } |
188 | 188 |
189 return IDBRequest::dispatchEventInternal(event); | 189 return IDBRequest::dispatchEventInternal(event); |
190 } | 190 } |
191 | 191 |
192 } // namespace blink | 192 } // namespace blink |
OLD | NEW |