Changeset 128312 in webkit


Ignore:
Timestamp:
Sep 12, 2012 8:21:46 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[BlackBerry] Use own instance of CertMgrWrapper in BlackBerry CredentialBackingStore.
https://bugs.webkit.org/show_bug.cgi?id=96457
Internal PR: 205769

Internally reviewed by George Staikos, Jonathan Dong.
Patch by Lianghui Chen <liachen@rim.com> on 2012-09-12
Reviewed by George Staikos.

CertMgrWrapper in BlackBerry platform layer has been changed from
singleton to normal class, every user of it need to create its own
instance now.

No new tests for platform specific interface change.

  • platform/network/blackberry/CredentialBackingStore.cpp:

(WebCore::CredentialBackingStore::CredentialBackingStore):
(WebCore::CredentialBackingStore::~CredentialBackingStore):
(WebCore::CredentialBackingStore::addLogin):
(WebCore::CredentialBackingStore::updateLogin):
(WebCore::CredentialBackingStore::getLogin):
(WebCore::CredentialBackingStore::certMgrWrapper):
(WebCore):

  • platform/network/blackberry/CredentialBackingStore.h:

(Platform):
(CredentialBackingStore):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r128311 r128312  
     12012-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
    1282012-09-12  Kenneth Rohde Christiansen  <kenneth@webkit.org>
    229
  • trunk/Source/WebCore/platform/network/blackberry/CredentialBackingStore.cpp

    r126596 r128312  
    7070    , m_getNeverRememberStatement(0)
    7171    , m_removeNeverRememberStatement(0)
    72     , m_usingCertManager(BlackBerry::Platform::CertMgrWrapper::instance()->isReady())
     72    , m_certMgrWrapper(0)
    7373{
    7474}
     
    7676CredentialBackingStore::~CredentialBackingStore()
    7777{
     78    delete m_certMgrWrapper;
     79    m_certMgrWrapper = 0;
    7880    delete m_addLoginStatement;
    7981    m_addLoginStatement = 0;
     
    185187    m_addLoginStatement->bindInt(6, static_cast<int>(protectionSpace.authenticationScheme()));
    186188    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()));
    188190
    189191    int result = m_addLoginStatement->step();
     
    192194        "Failed to add login info into table logins - %i", result);
    193195
    194     if (!m_usingCertManager)
     196    if (!certMgrWrapper()->isReady())
    195197        return true;
    196198    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());
    198200}
    199201
     
    207209
    208210    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()));
    210212    m_updateLoginStatement->bindText(3, url.string());
    211213    m_updateLoginStatement->bindText(4, protectionSpace.host());
     
    220222        "Failed to update login info in table logins - %i", result);
    221223
    222     if (!m_usingCertManager)
     224    if (!certMgrWrapper()->isReady())
    223225        return true;
    224226    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());
    226228}
    227229
     
    268270    int result = m_getLoginStatement->step();
    269271    String username = m_getLoginStatement->getColumnText(0);
    270     String password = m_usingCertManager ? "" : m_getLoginStatement->getColumnBlobAsString(1);
     272    String password = certMgrWrapper()->isReady() ? "" : m_getLoginStatement->getColumnBlobAsString(1);
    271273    String url = m_getLoginStatement->getColumnText(2);
    272274    m_getLoginStatement->reset();
     
    274276        "Failed to execute select login info from table logins in getLogin - %i", result);
    275277
    276     if (!m_usingCertManager)
     278    if (!certMgrWrapper()->isReady())
    277279        return Credential(username, decryptedString(password), CredentialPersistencePermanent);
    278280
    279281    unsigned hash = hashCredentialInfo(url, protectionSpace, username);
    280282    std::string passwordBlob;
    281     if (!BlackBerry::Platform::CertMgrWrapper::instance()->getPassword(hash, passwordBlob))
     283    if (!certMgrWrapper()->getPassword(hash, passwordBlob))
    282284        return Credential();
    283285    return Credential(username, decryptedString(passwordBlob.c_str()), CredentialPersistencePermanent);
     
    296298    int result = m_getLoginByURLStatement->step();
    297299    String username = m_getLoginByURLStatement->getColumnText(0);
    298     String password = m_usingCertManager ? "" : m_getLoginByURLStatement->getColumnBlobAsString(1);
     300    String password = certMgrWrapper()->isReady() ? "" : m_getLoginByURLStatement->getColumnBlobAsString(1);
    299301    String host = m_getLoginByURLStatement->getColumnText(2);
    300302    int port = m_getLoginByURLStatement->getColumnInt(3);
     
    306308        "Failed to execute select login info from table logins in getLoginByURL - %i", result);
    307309
    308     if (!m_usingCertManager)
     310    if (!certMgrWrapper()->isReady())
    309311        return Credential(username, decryptedString(password), CredentialPersistencePermanent);
    310312
     
    313315    unsigned hash = hashCredentialInfo(url, protectionSpace, username);
    314316    std::string passwordBlob;
    315     if (!BlackBerry::Platform::CertMgrWrapper::instance()->getPassword(hash, passwordBlob))
     317    if (!certMgrWrapper()->getPassword(hash, passwordBlob))
    316318        return Credential();
    317319    return Credential(username, decryptedString(passwordBlob.c_str()), CredentialPersistencePermanent);
     
    470472}
    471473
     474BlackBerry::Platform::CertMgrWrapper* CredentialBackingStore::certMgrWrapper()
     475{
     476    if (!m_certMgrWrapper)
     477        m_certMgrWrapper = new BlackBerry::Platform::CertMgrWrapper();
     478
     479    return m_certMgrWrapper;
     480}
     481
     482
    472483} // namespace WebCore
    473484
  • trunk/Source/WebCore/platform/network/blackberry/CredentialBackingStore.h

    r123694 r128312  
    2424#include "Credential.h"
    2525#include "SQLiteDatabase.h"
     26
     27namespace BlackBerry {
     28namespace Platform {
     29class CertMgrWrapper;
     30}
     31}
    2632
    2733namespace WebCore {
     
    5460    String decryptedString(const String& cipherText) const;
    5561
     62    BlackBerry::Platform::CertMgrWrapper* certMgrWrapper();
     63
    5664    SQLiteDatabase m_database;
    5765    SQLiteStatement* m_addLoginStatement;
     
    6674    SQLiteStatement* m_removeNeverRememberStatement;
    6775
    68     bool m_usingCertManager;
     76    BlackBerry::Platform::CertMgrWrapper* m_certMgrWrapper;
    6977};
    7078
Note: See TracChangeset for help on using the changeset viewer.