Changeset 128312 in webkit
- Timestamp:
- Sep 12, 2012 8:21:46 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r128311 r128312 1 2012-09-12 Lianghui Chen <liachen@rim.com> 2 3 [BlackBerry] Use own instance of CertMgrWrapper in BlackBerry CredentialBackingStore. 4 https://bugs.webkit.org/show_bug.cgi?id=96457 5 Internal PR: 205769 6 7 Internally reviewed by George Staikos, Jonathan Dong. 8 Reviewed by George Staikos. 9 10 CertMgrWrapper in BlackBerry platform layer has been changed from 11 singleton to normal class, every user of it need to create its own 12 instance now. 13 14 No new tests for platform specific interface change. 15 16 * platform/network/blackberry/CredentialBackingStore.cpp: 17 (WebCore::CredentialBackingStore::CredentialBackingStore): 18 (WebCore::CredentialBackingStore::~CredentialBackingStore): 19 (WebCore::CredentialBackingStore::addLogin): 20 (WebCore::CredentialBackingStore::updateLogin): 21 (WebCore::CredentialBackingStore::getLogin): 22 (WebCore::CredentialBackingStore::certMgrWrapper): 23 (WebCore): 24 * platform/network/blackberry/CredentialBackingStore.h: 25 (Platform): 26 (CredentialBackingStore): 27 1 28 2012-09-12 Kenneth Rohde Christiansen <kenneth@webkit.org> 2 29 -
trunk/Source/WebCore/platform/network/blackberry/CredentialBackingStore.cpp
r126596 r128312 70 70 , m_getNeverRememberStatement(0) 71 71 , m_removeNeverRememberStatement(0) 72 , m_ usingCertManager(BlackBerry::Platform::CertMgrWrapper::instance()->isReady())72 , m_certMgrWrapper(0) 73 73 { 74 74 } … … 76 76 CredentialBackingStore::~CredentialBackingStore() 77 77 { 78 delete m_certMgrWrapper; 79 m_certMgrWrapper = 0; 78 80 delete m_addLoginStatement; 79 81 m_addLoginStatement = 0; … … 185 187 m_addLoginStatement->bindInt(6, static_cast<int>(protectionSpace.authenticationScheme())); 186 188 m_addLoginStatement->bindText(7, credential.user()); 187 m_addLoginStatement->bindBlob(8, m_usingCertManager? "" : encryptedString(credential.password()));189 m_addLoginStatement->bindBlob(8, certMgrWrapper()->isReady() ? "" : encryptedString(credential.password())); 188 190 189 191 int result = m_addLoginStatement->step(); … … 192 194 "Failed to add login info into table logins - %i", result); 193 195 194 if (! m_usingCertManager)196 if (!certMgrWrapper()->isReady()) 195 197 return true; 196 198 unsigned hash = hashCredentialInfo(url.string(), protectionSpace, credential.user()); 197 return BlackBerry::Platform::CertMgrWrapper::instance()->savePassword(hash, encryptedString(credential.password()).latin1().data());199 return certMgrWrapper()->savePassword(hash, encryptedString(credential.password()).latin1().data()); 198 200 } 199 201 … … 207 209 208 210 m_updateLoginStatement->bindText(1, credential.user()); 209 m_updateLoginStatement->bindBlob(2, m_usingCertManager? "" : encryptedString(credential.password()));211 m_updateLoginStatement->bindBlob(2, certMgrWrapper()->isReady() ? "" : encryptedString(credential.password())); 210 212 m_updateLoginStatement->bindText(3, url.string()); 211 213 m_updateLoginStatement->bindText(4, protectionSpace.host()); … … 220 222 "Failed to update login info in table logins - %i", result); 221 223 222 if (! m_usingCertManager)224 if (!certMgrWrapper()->isReady()) 223 225 return true; 224 226 unsigned hash = hashCredentialInfo(url.string(), protectionSpace, credential.user()); 225 return BlackBerry::Platform::CertMgrWrapper::instance()->savePassword(hash, encryptedString(credential.password()).latin1().data());227 return certMgrWrapper()->savePassword(hash, encryptedString(credential.password()).latin1().data()); 226 228 } 227 229 … … 268 270 int result = m_getLoginStatement->step(); 269 271 String username = m_getLoginStatement->getColumnText(0); 270 String password = m_usingCertManager? "" : m_getLoginStatement->getColumnBlobAsString(1);272 String password = certMgrWrapper()->isReady() ? "" : m_getLoginStatement->getColumnBlobAsString(1); 271 273 String url = m_getLoginStatement->getColumnText(2); 272 274 m_getLoginStatement->reset(); … … 274 276 "Failed to execute select login info from table logins in getLogin - %i", result); 275 277 276 if (! m_usingCertManager)278 if (!certMgrWrapper()->isReady()) 277 279 return Credential(username, decryptedString(password), CredentialPersistencePermanent); 278 280 279 281 unsigned hash = hashCredentialInfo(url, protectionSpace, username); 280 282 std::string passwordBlob; 281 if (! BlackBerry::Platform::CertMgrWrapper::instance()->getPassword(hash, passwordBlob))283 if (!certMgrWrapper()->getPassword(hash, passwordBlob)) 282 284 return Credential(); 283 285 return Credential(username, decryptedString(passwordBlob.c_str()), CredentialPersistencePermanent); … … 296 298 int result = m_getLoginByURLStatement->step(); 297 299 String username = m_getLoginByURLStatement->getColumnText(0); 298 String password = m_usingCertManager? "" : m_getLoginByURLStatement->getColumnBlobAsString(1);300 String password = certMgrWrapper()->isReady() ? "" : m_getLoginByURLStatement->getColumnBlobAsString(1); 299 301 String host = m_getLoginByURLStatement->getColumnText(2); 300 302 int port = m_getLoginByURLStatement->getColumnInt(3); … … 306 308 "Failed to execute select login info from table logins in getLoginByURL - %i", result); 307 309 308 if (! m_usingCertManager)310 if (!certMgrWrapper()->isReady()) 309 311 return Credential(username, decryptedString(password), CredentialPersistencePermanent); 310 312 … … 313 315 unsigned hash = hashCredentialInfo(url, protectionSpace, username); 314 316 std::string passwordBlob; 315 if (! BlackBerry::Platform::CertMgrWrapper::instance()->getPassword(hash, passwordBlob))317 if (!certMgrWrapper()->getPassword(hash, passwordBlob)) 316 318 return Credential(); 317 319 return Credential(username, decryptedString(passwordBlob.c_str()), CredentialPersistencePermanent); … … 470 472 } 471 473 474 BlackBerry::Platform::CertMgrWrapper* CredentialBackingStore::certMgrWrapper() 475 { 476 if (!m_certMgrWrapper) 477 m_certMgrWrapper = new BlackBerry::Platform::CertMgrWrapper(); 478 479 return m_certMgrWrapper; 480 } 481 482 472 483 } // namespace WebCore 473 484 -
trunk/Source/WebCore/platform/network/blackberry/CredentialBackingStore.h
r123694 r128312 24 24 #include "Credential.h" 25 25 #include "SQLiteDatabase.h" 26 27 namespace BlackBerry { 28 namespace Platform { 29 class CertMgrWrapper; 30 } 31 } 26 32 27 33 namespace WebCore { … … 54 60 String decryptedString(const String& cipherText) const; 55 61 62 BlackBerry::Platform::CertMgrWrapper* certMgrWrapper(); 63 56 64 SQLiteDatabase m_database; 57 65 SQLiteStatement* m_addLoginStatement; … … 66 74 SQLiteStatement* m_removeNeverRememberStatement; 67 75 68 bool m_usingCertManager;76 BlackBerry::Platform::CertMgrWrapper* m_certMgrWrapper; 69 77 }; 70 78
Note: See TracChangeset
for help on using the changeset viewer.