OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2013 Apple 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 11 matching lines...) Expand all Loading... |
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 */ | 27 */ |
28 | 28 |
29 #include "config.h" | 29 #include "config.h" |
30 #include "modules/webdatabase/SQLTransaction.h" | 30 #include "modules/webdatabase/SQLTransaction.h" |
31 | 31 |
32 #include "bindings/v8/ExceptionState.h" | |
33 #include "core/dom/ExceptionCode.h" | 32 #include "core/dom/ExceptionCode.h" |
34 #include "core/html/VoidCallback.h" | 33 #include "core/html/VoidCallback.h" |
35 #include "core/platform/Logging.h" | 34 #include "core/platform/Logging.h" |
36 #include "modules/webdatabase/AbstractSQLTransactionBackend.h" | 35 #include "modules/webdatabase/AbstractSQLTransactionBackend.h" |
37 #include "modules/webdatabase/Database.h" | 36 #include "modules/webdatabase/Database.h" |
38 #include "modules/webdatabase/DatabaseAuthorizer.h" | 37 #include "modules/webdatabase/DatabaseAuthorizer.h" |
39 #include "modules/webdatabase/DatabaseContext.h" | 38 #include "modules/webdatabase/DatabaseContext.h" |
40 #include "modules/webdatabase/SQLError.h" | 39 #include "modules/webdatabase/SQLError.h" |
41 #include "modules/webdatabase/SQLStatementCallback.h" | 40 #include "modules/webdatabase/SQLStatementCallback.h" |
42 #include "modules/webdatabase/SQLStatementErrorCallback.h" | 41 #include "modules/webdatabase/SQLStatementErrorCallback.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 m_backend->requestTransitToState(m_nextState); | 243 m_backend->requestTransitToState(m_nextState); |
245 return SQLTransactionState::Idle; | 244 return SQLTransactionState::Idle; |
246 } | 245 } |
247 | 246 |
248 void SQLTransaction::performPendingCallback() | 247 void SQLTransaction::performPendingCallback() |
249 { | 248 { |
250 computeNextStateAndCleanupIfNeeded(); | 249 computeNextStateAndCleanupIfNeeded(); |
251 runStateMachine(); | 250 runStateMachine(); |
252 } | 251 } |
253 | 252 |
254 void SQLTransaction::executeSQL(const String& sqlStatement, const Vector<SQLValu
e>& arguments, PassRefPtr<SQLStatementCallback> callback, PassRefPtr<SQLStatemen
tErrorCallback> callbackError, ExceptionState& es) | 253 void SQLTransaction::executeSQL(const String& sqlStatement, const Vector<SQLValu
e>& arguments, PassRefPtr<SQLStatementCallback> callback, PassRefPtr<SQLStatemen
tErrorCallback> callbackError, ExceptionCode& ec) |
255 { | 254 { |
256 if (!m_executeSqlAllowed || !m_database->opened()) { | 255 if (!m_executeSqlAllowed || !m_database->opened()) { |
257 es.throwDOMException(InvalidStateError); | 256 ec = InvalidStateError; |
258 return; | 257 return; |
259 } | 258 } |
260 | 259 |
261 int permissions = DatabaseAuthorizer::ReadWriteMask; | 260 int permissions = DatabaseAuthorizer::ReadWriteMask; |
262 if (!m_database->databaseContext()->allowDatabaseAccess()) | 261 if (!m_database->databaseContext()->allowDatabaseAccess()) |
263 permissions |= DatabaseAuthorizer::NoAccessMask; | 262 permissions |= DatabaseAuthorizer::NoAccessMask; |
264 else if (m_readOnly) | 263 else if (m_readOnly) |
265 permissions |= DatabaseAuthorizer::ReadOnlyMask; | 264 permissions |= DatabaseAuthorizer::ReadOnlyMask; |
266 | 265 |
267 OwnPtr<SQLStatement> statement = SQLStatement::create(m_database.get(), call
back, callbackError); | 266 OwnPtr<SQLStatement> statement = SQLStatement::create(m_database.get(), call
back, callbackError); |
(...skipping 25 matching lines...) Expand all Loading... |
293 | 292 |
294 void SQLTransaction::clearCallbackWrappers() | 293 void SQLTransaction::clearCallbackWrappers() |
295 { | 294 { |
296 // Release the unneeded callbacks, to break reference cycles. | 295 // Release the unneeded callbacks, to break reference cycles. |
297 m_callbackWrapper.clear(); | 296 m_callbackWrapper.clear(); |
298 m_successCallbackWrapper.clear(); | 297 m_successCallbackWrapper.clear(); |
299 m_errorCallbackWrapper.clear(); | 298 m_errorCallbackWrapper.clear(); |
300 } | 299 } |
301 | 300 |
302 } // namespace WebCore | 301 } // namespace WebCore |
OLD | NEW |