| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 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 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 PassRefPtr<Database> WorkerGlobalScopeWebDatabase::openDatabase(WorkerGlobalScop
e* context, const String& name, const String& version, const String& displayName
, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback, Ex
ceptionCode& ec) | 42 PassRefPtr<Database> WorkerGlobalScopeWebDatabase::openDatabase(WorkerGlobalScop
e* context, const String& name, const String& version, const String& displayName
, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback, Ex
ceptionCode& ec) |
| 43 { | 43 { |
| 44 DatabaseManager& dbManager = DatabaseManager::manager(); | 44 DatabaseManager& dbManager = DatabaseManager::manager(); |
| 45 RefPtr<Database> database; | 45 RefPtr<Database> database; |
| 46 DatabaseError error = DatabaseError::None; | 46 DatabaseError error = DatabaseError::None; |
| 47 if (RuntimeEnabledFeatures::databaseEnabled() && context->securityOrigin()->
canAccessDatabase(context->topOrigin())) { | 47 if (RuntimeEnabledFeatures::databaseEnabled() && context->securityOrigin()->
canAccessDatabase(context->topOrigin())) { |
| 48 database = dbManager.openDatabase(context, name, version, displayName, e
stimatedSize, creationCallback, error); | 48 database = dbManager.openDatabase(context, name, version, displayName, e
stimatedSize, creationCallback, error); |
| 49 ASSERT(database || error != DatabaseError::None); | 49 ASSERT(database || error != DatabaseError::None); |
| 50 ec = DatabaseManager::exceptionCodeForDatabaseError(error); | 50 ec = DatabaseManager::exceptionCodeForDatabaseError(error); |
| 51 } else | 51 } else { |
| 52 ec = SECURITY_ERR; | 52 ec = SecurityError; |
| 53 } |
| 53 | 54 |
| 54 return database.release(); | 55 return database.release(); |
| 55 } | 56 } |
| 56 | 57 |
| 57 PassRefPtr<DatabaseSync> WorkerGlobalScopeWebDatabase::openDatabaseSync(WorkerGl
obalScope* context, const String& name, const String& version, const String& dis
playName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCall
back, ExceptionCode& ec) | 58 PassRefPtr<DatabaseSync> WorkerGlobalScopeWebDatabase::openDatabaseSync(WorkerGl
obalScope* context, const String& name, const String& version, const String& dis
playName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCall
back, ExceptionCode& ec) |
| 58 { | 59 { |
| 59 DatabaseManager& dbManager = DatabaseManager::manager(); | 60 DatabaseManager& dbManager = DatabaseManager::manager(); |
| 60 RefPtr<DatabaseSync> database; | 61 RefPtr<DatabaseSync> database; |
| 61 DatabaseError error = DatabaseError::None; | 62 DatabaseError error = DatabaseError::None; |
| 62 if (RuntimeEnabledFeatures::databaseEnabled() && context->securityOrigin()->
canAccessDatabase(context->topOrigin())) { | 63 if (RuntimeEnabledFeatures::databaseEnabled() && context->securityOrigin()->
canAccessDatabase(context->topOrigin())) { |
| 63 database = dbManager.openDatabaseSync(context, name, version, displayNam
e, estimatedSize, creationCallback, error); | 64 database = dbManager.openDatabaseSync(context, name, version, displayNam
e, estimatedSize, creationCallback, error); |
| 64 | 65 |
| 65 ASSERT(database || error != DatabaseError::None); | 66 ASSERT(database || error != DatabaseError::None); |
| 66 ec = DatabaseManager::exceptionCodeForDatabaseError(error); | 67 ec = DatabaseManager::exceptionCodeForDatabaseError(error); |
| 67 } else | 68 } else { |
| 68 ec = SECURITY_ERR; | 69 ec = SecurityError; |
| 70 } |
| 69 | 71 |
| 70 return database.release(); | 72 return database.release(); |
| 71 } | 73 } |
| 72 | 74 |
| 73 } // namespace WebCore | 75 } // namespace WebCore |
| OLD | NEW |