Changeset 74093 in webkit


Ignore:
Timestamp:
Dec 14, 2010 7:01:58 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2010-12-14 Anton D'Auria <adauria@apple.com>

Reviewed by Darin Adler.

Do not allow access to existing HTML5 databases in private browsing
mode https://bugs.webkit.org/show_bug.cgi?id=49332

Test: storage/private-browsing-noread-nowrite.html

Previously, read-only transactions and private browsing mode were
represented by the same SQLStatement and DatabaseAuthorizer states.
This patch removes the m_readOnly member variable from SQLStatement and
DatabaseAuthorizer, and replaces it with m_permissions whose bit fields
are initialized by a DatabaseAuthorizer enum Permissions (ReadWrite,
ReadOnly, NoAccess). A read-only transaction sets permissions to
ReadOnly, and if !m_database->scriptExecutionContext()->allowDatabaseAccess(),
then permissions also set to NoAccess.

  • dom/Document.cpp: (WebCore::Document::allowDatabaseAccess): this method was previously called isDatabaseReadOnly. It checks if private browsing preference is set. This method is renamed because it is used to check if private browsing restricts access to databases.
  • dom/Document.h:
  • dom/ScriptExecutionContext.h:
  • storage/AbstractDatabase.cpp: (WebCore::AbstractDatabase::setAuthorizerPermissions):
  • storage/AbstractDatabase.h:
  • storage/DatabaseAuthorizer.cpp: (WebCore::DatabaseAuthorizer::reset): (WebCore::DatabaseAuthorizer::createTable): (WebCore::DatabaseAuthorizer::createTempTable): (WebCore::DatabaseAuthorizer::dropTable): (WebCore::DatabaseAuthorizer::dropTempTable): (WebCore::DatabaseAuthorizer::allowAlterTable): (WebCore::DatabaseAuthorizer::createIndex): (WebCore::DatabaseAuthorizer::createTempIndex): (WebCore::DatabaseAuthorizer::dropIndex): (WebCore::DatabaseAuthorizer::dropTempIndex): (WebCore::DatabaseAuthorizer::createTrigger): (WebCore::DatabaseAuthorizer::createTempTrigger): (WebCore::DatabaseAuthorizer::dropTrigger): (WebCore::DatabaseAuthorizer::dropTempTrigger): (WebCore::DatabaseAuthorizer::createView): (WebCore::DatabaseAuthorizer::createTempView): (WebCore::DatabaseAuthorizer::dropView): (WebCore::DatabaseAuthorizer::dropTempView): (WebCore::DatabaseAuthorizer::createVTable): (WebCore::DatabaseAuthorizer::dropVTable): (WebCore::DatabaseAuthorizer::allowDelete): (WebCore::DatabaseAuthorizer::allowInsert): (WebCore::DatabaseAuthorizer::allowUpdate): (WebCore::DatabaseAuthorizer::allowRead): (WebCore::DatabaseAuthorizer::allowReindex): (WebCore::DatabaseAuthorizer::allowWrite): a new private method that checks if DatabaseAuthorizer is enabled and if it is in ReadOnly or NoAccess mode. (WebCore::DatabaseAuthorizer::setReadOnly): (WebCore::DatabaseAuthorizer::setPermissions):
  • storage/DatabaseAuthorizer.h:
  • storage/SQLStatement.cpp: (WebCore::SQLStatement::create): (WebCore::SQLStatement::SQLStatement): (WebCore::SQLStatement::execute):
  • storage/SQLStatement.h:
  • storage/SQLStatementSync.cpp: (WebCore::SQLStatementSync::SQLStatementSync): (WebCore::SQLStatementSync::execute):
  • storage/SQLStatementSync.h:
  • storage/SQLTransaction.cpp: (WebCore::SQLTransaction::executeSQL):
  • storage/SQLTransactionSync.cpp: (WebCore::SQLTransactionSync::executeSQL):
  • workers/WorkerContext.h: (WebCore::WorkerContext::allowDatabaseAccess):
Location:
trunk
Files:
15 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/storage/private-browsing-noread-nowrite-expected.txt

    r74092 r74093  
    1010Private browsing statement 4 completed with an error
    1111not authorized
     12Private browsing statement 5 completed with an error
     13access to PrivateTest1.randomData is prohibited
    1214Test ended
    1315
  • trunk/LayoutTests/storage/private-browsing-noread-nowrite.html

    r74092 r74093  
    1717    "DELETE FROM PrivateTest1",
    1818    "DROP TABLE PrivateTest1",
    19     "INSERT INTO PrivateTest1 VALUES ('somedata')"
     19    "INSERT INTO PrivateTest1 VALUES ('somedata')",
     20    "SELECT * FROM PrivateTest1"
    2021];
    2122
     
    8990    }
    9091
    91     var database = openDatabase("PrivateBrowsingReadOnlyTest", "1.0", "Test private browsing read-only safety", 1);
     92    var database = openDatabase("PrivateBrowsingNoReadNoWriteTest", "1.0", "Test private browsing no read/write safety", 1);
    9293    database.transaction(runSetup, endTest, endTest);
    9394}
  • trunk/WebCore/ChangeLog

    r74089 r74093  
     12010-12-14  Anton D'Auria  <adauria@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Do not allow access to existing HTML5 databases in private browsing
     6        mode https://bugs.webkit.org/show_bug.cgi?id=49332
     7
     8        Test: storage/private-browsing-noread-nowrite.html
     9
     10        Previously, read-only transactions and private browsing mode were
     11        represented by the same SQLStatement and DatabaseAuthorizer states.
     12        This patch removes the m_readOnly member variable from SQLStatement and
     13        DatabaseAuthorizer, and replaces it with m_permissions whose bit fields
     14        are initialized by a DatabaseAuthorizer enum Permissions (ReadWrite,
     15        ReadOnly, NoAccess). A read-only transaction sets permissions to
     16        ReadOnly, and if !m_database->scriptExecutionContext()->allowDatabaseAccess(),
     17        then permissions also set to NoAccess.
     18
     19        * dom/Document.cpp:
     20        (WebCore::Document::allowDatabaseAccess): this method was previously
     21        called isDatabaseReadOnly. It checks if private browsing preference is
     22        set. This method is renamed because it is used to check if private
     23        browsing restricts access to databases.
     24        * dom/Document.h:
     25        * dom/ScriptExecutionContext.h:
     26        * storage/AbstractDatabase.cpp:
     27        (WebCore::AbstractDatabase::setAuthorizerPermissions):
     28        * storage/AbstractDatabase.h:
     29        * storage/DatabaseAuthorizer.cpp:
     30        (WebCore::DatabaseAuthorizer::reset):
     31        (WebCore::DatabaseAuthorizer::createTable):
     32        (WebCore::DatabaseAuthorizer::createTempTable):
     33        (WebCore::DatabaseAuthorizer::dropTable):
     34        (WebCore::DatabaseAuthorizer::dropTempTable):
     35        (WebCore::DatabaseAuthorizer::allowAlterTable):
     36        (WebCore::DatabaseAuthorizer::createIndex):
     37        (WebCore::DatabaseAuthorizer::createTempIndex):
     38        (WebCore::DatabaseAuthorizer::dropIndex):
     39        (WebCore::DatabaseAuthorizer::dropTempIndex):
     40        (WebCore::DatabaseAuthorizer::createTrigger):
     41        (WebCore::DatabaseAuthorizer::createTempTrigger):
     42        (WebCore::DatabaseAuthorizer::dropTrigger):
     43        (WebCore::DatabaseAuthorizer::dropTempTrigger):
     44        (WebCore::DatabaseAuthorizer::createView):
     45        (WebCore::DatabaseAuthorizer::createTempView):
     46        (WebCore::DatabaseAuthorizer::dropView):
     47        (WebCore::DatabaseAuthorizer::dropTempView):
     48        (WebCore::DatabaseAuthorizer::createVTable):
     49        (WebCore::DatabaseAuthorizer::dropVTable):
     50        (WebCore::DatabaseAuthorizer::allowDelete):
     51        (WebCore::DatabaseAuthorizer::allowInsert):
     52        (WebCore::DatabaseAuthorizer::allowUpdate):
     53        (WebCore::DatabaseAuthorizer::allowRead):
     54        (WebCore::DatabaseAuthorizer::allowReindex):
     55        (WebCore::DatabaseAuthorizer::allowWrite): a new private method that
     56        checks if DatabaseAuthorizer is enabled and if it is in ReadOnly or
     57        NoAccess mode.
     58        (WebCore::DatabaseAuthorizer::setReadOnly):
     59        (WebCore::DatabaseAuthorizer::setPermissions):
     60        * storage/DatabaseAuthorizer.h:
     61        * storage/SQLStatement.cpp:
     62        (WebCore::SQLStatement::create):
     63        (WebCore::SQLStatement::SQLStatement):
     64        (WebCore::SQLStatement::execute):
     65        * storage/SQLStatement.h:
     66        * storage/SQLStatementSync.cpp:
     67        (WebCore::SQLStatementSync::SQLStatementSync):
     68        (WebCore::SQLStatementSync::execute):
     69        * storage/SQLStatementSync.h:
     70        * storage/SQLTransaction.cpp:
     71        (WebCore::SQLTransaction::executeSQL):
     72        * storage/SQLTransactionSync.cpp:
     73        (WebCore::SQLTransactionSync::executeSQL):
     74        * workers/WorkerContext.h:
     75        (WebCore::WorkerContext::allowDatabaseAccess):
     76
    1772010-12-02  MORITA Hajime  <morrita@google.com>
    278
  • trunk/WebCore/dom/Document.cpp

    r74062 r74093  
    44974497#if ENABLE(DATABASE)
    44984498
    4499 bool Document::isDatabaseReadOnly() const
     4499bool Document::allowDatabaseAccess() const
    45004500{
    45014501    if (!page() || page()->settings()->privateBrowsingEnabled())
    4502         return true;
    4503     return false;
     4502        return false;
     4503    return true;
    45044504}
    45054505
  • trunk/WebCore/dom/Document.h

    r74062 r74093  
    10071007
    10081008#if ENABLE(DATABASE)
    1009     virtual bool isDatabaseReadOnly() const;
     1009    virtual bool allowDatabaseAccess() const;
    10101010    virtual void databaseExceededQuota(const String& name);
    10111011#endif
  • trunk/WebCore/dom/ScriptExecutionContext.h

    r73939 r74093  
    7171
    7272#if ENABLE(DATABASE)
    73         virtual bool isDatabaseReadOnly() const = 0;
     73        virtual bool allowDatabaseAccess() const = 0;
    7474        virtual void databaseExceededQuota(const String& name) = 0;
    7575        DatabaseThread* databaseThread();
  • trunk/WebCore/storage/AbstractDatabase.cpp

    r67619 r74093  
    433433}
    434434
     435void AbstractDatabase::setAuthorizerPermissions(int permissions)
     436{
     437    ASSERT(m_databaseAuthorizer);
     438    m_databaseAuthorizer->setPermissions(permissions);
     439}
     440
    435441bool AbstractDatabase::lastActionChangedDatabase()
    436442{
  • trunk/WebCore/storage/AbstractDatabase.h

    r64384 r74093  
    8181    void enableAuthorizer();
    8282    void setAuthorizerReadOnly();
     83    void setAuthorizerPermissions(int permissions);
    8384    bool lastActionChangedDatabase();
    8485    bool lastActionWasInsert();
  • trunk/WebCore/storage/DatabaseAuthorizer.cpp

    r66717 r74093  
    5454    m_lastActionWasInsert = false;
    5555    m_lastActionChangedDatabase = false;
    56     m_readOnly = false;
     56    m_permissions = ReadWriteMask;
    5757}
    5858
     
    128128int DatabaseAuthorizer::createTable(const String& tableName)
    129129{
    130     if (m_readOnly && m_securityEnabled)
     130    if (!allowWrite())
    131131        return SQLAuthDeny;
    132132
     
    140140    // allowed in read-only transactions or private browsing, so we might as
    141141    // well disallow SQLITE_CREATE_TEMP_TABLE in these cases
    142     if (m_readOnly && m_securityEnabled)
     142    if (!allowWrite())
    143143        return SQLAuthDeny;
    144144
     
    148148int DatabaseAuthorizer::dropTable(const String& tableName)
    149149{
    150     if (m_readOnly && m_securityEnabled)
     150    if (!allowWrite())
    151151        return SQLAuthDeny;
    152152
     
    159159    // allowed in read-only transactions or private browsing, so we might as
    160160    // well disallow SQLITE_DROP_TEMP_TABLE in these cases
    161     if (m_readOnly && m_securityEnabled)
     161    if (!allowWrite())
    162162        return SQLAuthDeny;
    163163
     
    167167int DatabaseAuthorizer::allowAlterTable(const String&, const String& tableName)
    168168{
    169     if (m_readOnly && m_securityEnabled)
     169    if (!allowWrite())
    170170        return SQLAuthDeny;
    171171
     
    176176int DatabaseAuthorizer::createIndex(const String&, const String& tableName)
    177177{
    178     if (m_readOnly && m_securityEnabled)
     178    if (!allowWrite())
    179179        return SQLAuthDeny;
    180180
     
    188188    // which is not allowed in read-only transactions or private browsing,
    189189    // so we might as well disallow SQLITE_CREATE_TEMP_INDEX in these cases
    190     if (m_readOnly && m_securityEnabled)
     190    if (!allowWrite())
    191191        return SQLAuthDeny;
    192192
     
    196196int DatabaseAuthorizer::dropIndex(const String&, const String& tableName)
    197197{
    198     if (m_readOnly && m_securityEnabled)
     198    if (!allowWrite())
    199199        return SQLAuthDeny;
    200200
     
    207207    // not allowed in read-only transactions or private browsing, so we might
    208208    // as well disallow SQLITE_DROP_TEMP_INDEX in these cases
    209     if (m_readOnly && m_securityEnabled)
     209    if (!allowWrite())
    210210        return SQLAuthDeny;
    211211
     
    215215int DatabaseAuthorizer::createTrigger(const String&, const String& tableName)
    216216{
    217     if (m_readOnly && m_securityEnabled)
     217    if (!allowWrite())
    218218        return SQLAuthDeny;
    219219
     
    227227    // allowed in read-only transactions or private browsing, so we might as
    228228    // well disallow SQLITE_CREATE_TEMP_TRIGGER in these cases
    229     if (m_readOnly && m_securityEnabled)
     229    if (!allowWrite())
    230230        return SQLAuthDeny;
    231231
     
    235235int DatabaseAuthorizer::dropTrigger(const String&, const String& tableName)
    236236{
    237     if (m_readOnly && m_securityEnabled)
     237    if (!allowWrite())
    238238        return SQLAuthDeny;
    239239
     
    246246    // allowed in read-only transactions or private browsing, so we might as
    247247    // well disallow SQLITE_DROP_TEMP_TRIGGER in these cases
    248     if (m_readOnly && m_securityEnabled)
     248    if (!allowWrite())
    249249        return SQLAuthDeny;
    250250
     
    254254int DatabaseAuthorizer::createView(const String&)
    255255{
    256     return (m_readOnly && m_securityEnabled ? SQLAuthDeny : SQLAuthAllow);
     256    return (!allowWrite() ? SQLAuthDeny : SQLAuthAllow);
    257257}
    258258
     
    262262    // allowed in read-only transactions or private browsing, so we might as
    263263    // well disallow SQLITE_CREATE_TEMP_VIEW in these cases
    264     return (m_readOnly && m_securityEnabled ? SQLAuthDeny : SQLAuthAllow);
     264    return (!allowWrite() ? SQLAuthDeny : SQLAuthAllow);
    265265}
    266266
    267267int DatabaseAuthorizer::dropView(const String&)
    268268{
    269     if (m_readOnly && m_securityEnabled)
     269    if (!allowWrite())
    270270        return SQLAuthDeny;
    271271
     
    279279    // allowed in read-only transactions or private browsing, so we might as
    280280    // well disallow SQLITE_DROP_TEMP_VIEW in these cases
    281     if (m_readOnly && m_securityEnabled)
     281    if (!allowWrite())
    282282        return SQLAuthDeny;
    283283
     
    288288int DatabaseAuthorizer::createVTable(const String& tableName, const String& moduleName)
    289289{
    290     if (m_readOnly && m_securityEnabled)
     290    if (!allowWrite())
    291291        return SQLAuthDeny;
    292292
     
    301301int DatabaseAuthorizer::dropVTable(const String& tableName, const String& moduleName)
    302302{
    303     if (m_readOnly && m_securityEnabled)
     303    if (!allowWrite())
    304304        return SQLAuthDeny;
    305305
     
    313313int DatabaseAuthorizer::allowDelete(const String& tableName)
    314314{
    315     if (m_readOnly && m_securityEnabled)
     315    if (!allowWrite())
    316316        return SQLAuthDeny;
    317317
     
    321321int DatabaseAuthorizer::allowInsert(const String& tableName)
    322322{
    323     if (m_readOnly && m_securityEnabled)
     323    if (!allowWrite())
    324324        return SQLAuthDeny;
    325325
     
    331331int DatabaseAuthorizer::allowUpdate(const String& tableName, const String&)
    332332{
    333     if (m_readOnly && m_securityEnabled)
     333    if (!allowWrite())
    334334        return SQLAuthDeny;
    335335
     
    345345int DatabaseAuthorizer::allowRead(const String& tableName, const String&)
    346346{
     347    if (m_permissions & NoAccessMask && m_securityEnabled)
     348        return SQLAuthDeny;
     349   
    347350    return denyBasedOnTableName(tableName);
    348351}
     
    350353int DatabaseAuthorizer::allowReindex(const String&)
    351354{
    352     return (m_readOnly && m_securityEnabled ? SQLAuthDeny : SQLAuthAllow);
     355    return (!allowWrite() ? SQLAuthDeny : SQLAuthAllow);
    353356}
    354357
     
    391394}
    392395
     396bool DatabaseAuthorizer::allowWrite()
     397{
     398    return !(m_securityEnabled && (m_permissions & ReadOnlyMask || m_permissions & NoAccessMask));
     399}
     400
    393401void DatabaseAuthorizer::setReadOnly()
    394402{
    395     m_readOnly = true;
     403    m_permissions |= ReadOnlyMask;
     404}
     405   
     406void DatabaseAuthorizer::setPermissions(int permissions)
     407{
     408    m_permissions = permissions;
    396409}
    397410
  • trunk/WebCore/storage/DatabaseAuthorizer.h

    r65077 r74093  
    4343class DatabaseAuthorizer : public ThreadSafeShared<DatabaseAuthorizer> {
    4444public:
     45
     46    enum Permissions {
     47        ReadWriteMask = 0,
     48        ReadOnlyMask = 1 << 1,
     49        NoAccessMask = 1 << 2
     50    };
     51
    4552    static PassRefPtr<DatabaseAuthorizer> create(const String& databaseInfoTableName);
    4653
     
    8895    void enable();
    8996    void setReadOnly();
     97    void setPermissions(int permissions);
    9098
    9199    void reset();
     
    101109    int denyBasedOnTableName(const String&) const;
    102110    int updateDeletesBasedOnTableName(const String&);
     111    bool allowWrite();
    103112
     113    int m_permissions;
    104114    bool m_securityEnabled : 1;
    105115    bool m_lastActionWasInsert : 1;
    106116    bool m_lastActionChangedDatabase : 1;
    107     bool m_readOnly : 1;
    108117    bool m_hadDeletes : 1;
    109118
  • trunk/WebCore/storage/SQLStatement.cpp

    r65344 r74093  
    4444namespace WebCore {
    4545
    46 PassRefPtr<SQLStatement> SQLStatement::create(const String& statement, const Vector<SQLValue>& arguments, PassRefPtr<SQLStatementCallback> callback, PassRefPtr<SQLStatementErrorCallback> errorCallback, bool readOnly)
    47 {
    48     return adoptRef(new SQLStatement(statement, arguments, callback, errorCallback, readOnly));
    49 }
    50 
    51 SQLStatement::SQLStatement(const String& statement, const Vector<SQLValue>& arguments, PassRefPtr<SQLStatementCallback> callback, PassRefPtr<SQLStatementErrorCallback> errorCallback, bool readOnly)
     46PassRefPtr<SQLStatement> SQLStatement::create(const String& statement, const Vector<SQLValue>& arguments, PassRefPtr<SQLStatementCallback> callback, PassRefPtr<SQLStatementErrorCallback> errorCallback, int permissions)
     47{
     48    return adoptRef(new SQLStatement(statement, arguments, callback, errorCallback, permissions));
     49}
     50
     51SQLStatement::SQLStatement(const String& statement, const Vector<SQLValue>& arguments, PassRefPtr<SQLStatementCallback> callback, PassRefPtr<SQLStatementErrorCallback> errorCallback, int permissions)
    5252    : m_statement(statement.crossThreadString())
    5353    , m_arguments(arguments)
    5454    , m_statementCallback(callback)
    5555    , m_statementErrorCallback(errorCallback)
    56     , m_readOnly(readOnly)
     56    , m_permissions(permissions)
    5757{
    5858}
     
    7070        return false;
    7171
    72     if (m_readOnly)
    73         db->setAuthorizerReadOnly();
     72    db->setAuthorizerPermissions(m_permissions);
    7473
    7574    SQLiteDatabase* database = &db->sqliteDatabase();
  • trunk/WebCore/storage/SQLStatement.h

    r60508 r74093  
    4747class SQLStatement : public ThreadSafeShared<SQLStatement> {
    4848public:
    49     static PassRefPtr<SQLStatement> create(const String&, const Vector<SQLValue>&, PassRefPtr<SQLStatementCallback>, PassRefPtr<SQLStatementErrorCallback>, bool readOnly);
     49    static PassRefPtr<SQLStatement> create(const String&, const Vector<SQLValue>&, PassRefPtr<SQLStatementCallback>, PassRefPtr<SQLStatementErrorCallback>, int permissions);
    5050
    5151    bool execute(Database*);
     
    6262    SQLError* sqlError() const { return m_error.get(); }
    6363private:
    64     SQLStatement(const String& statement, const Vector<SQLValue>& arguments, PassRefPtr<SQLStatementCallback>, PassRefPtr<SQLStatementErrorCallback>, bool readOnly);
     64    SQLStatement(const String& statement, const Vector<SQLValue>& arguments, PassRefPtr<SQLStatementCallback>, PassRefPtr<SQLStatementErrorCallback>, int permissions);
    6565
    6666    void setFailureDueToQuota();
     
    7575    RefPtr<SQLResultSet> m_resultSet;
    7676
    77     bool m_readOnly;
     77    int m_permissions;
    7878};
    7979
  • trunk/WebCore/storage/SQLStatementSync.cpp

    r64384 r74093  
    4444namespace WebCore {
    4545
    46 SQLStatementSync::SQLStatementSync(const String& statement, const Vector<SQLValue>& arguments, bool readOnly)
     46SQLStatementSync::SQLStatementSync(const String& statement, const Vector<SQLValue>& arguments, int permissions)
    4747    : m_statement(statement)
    4848    , m_arguments(arguments)
    49     , m_readOnly(readOnly)
     49    , m_permissions(permissions)
    5050{
    5151    ASSERT(!m_statement.isEmpty());
     
    5454PassRefPtr<SQLResultSet> SQLStatementSync::execute(DatabaseSync* db, ExceptionCode& ec)
    5555{
    56     if (m_readOnly)
    57         db->setAuthorizerReadOnly();
     56    db->setAuthorizerPermissions(m_permissions);
    5857
    5958    SQLiteDatabase* database = &db->sqliteDatabase();
  • trunk/WebCore/storage/SQLStatementSync.h

    r63278 r74093  
    4747class SQLStatementSync {
    4848public:
    49     SQLStatementSync(const String& statement, const Vector<SQLValue>& arguments, bool readOnly);
     49    SQLStatementSync(const String& statement, const Vector<SQLValue>& arguments, int permissions);
    5050
    5151    PassRefPtr<SQLResultSet> execute(DatabaseSync*, ExceptionCode&);
     
    5454    String m_statement;
    5555    Vector<SQLValue> m_arguments;
    56     bool m_readOnly;
     56    int m_permissions;
    5757};
    5858
  • trunk/WebCore/storage/SQLTransaction.cpp

    r65871 r74093  
    3333
    3434#include "Database.h"
     35#include "DatabaseAuthorizer.h"
    3536#include "DatabaseThread.h"
    3637#include "Logging.h"
     
    9495    }
    9596
    96     bool readOnlyMode = m_readOnly;
    97     if (!readOnlyMode) {
    98         if (m_database->scriptExecutionContext()->isDatabaseReadOnly())
    99             readOnlyMode = true;
    100     }
    101 
    102     RefPtr<SQLStatement> statement = SQLStatement::create(sqlStatement, arguments, callback, callbackError, readOnlyMode);
     97    int permissions = DatabaseAuthorizer::ReadWriteMask;
     98    if (!m_database->scriptExecutionContext()->allowDatabaseAccess())
     99        permissions |= DatabaseAuthorizer::NoAccessMask;
     100    else if (m_readOnly)
     101        permissions |= DatabaseAuthorizer::ReadOnlyMask;
     102
     103    RefPtr<SQLStatement> statement = SQLStatement::create(sqlStatement, arguments, callback, callbackError, permissions);
    103104
    104105    if (m_database->deleted())
  • trunk/WebCore/storage/SQLTransactionSync.cpp

    r65871 r74093  
    3434#if ENABLE(DATABASE)
    3535
     36#include "DatabaseAuthorizer.h"
    3637#include "DatabaseSync.h"
    3738#include "PlatformString.h"
     
    8788        return 0;
    8889
    89     bool readOnlyMode = m_readOnly || m_database->scriptExecutionContext()->isDatabaseReadOnly();
    90     SQLStatementSync statement(sqlStatement, arguments, readOnlyMode);
     90    int permissions = DatabaseAuthorizer::ReadWriteMask;
     91    if (!m_database->scriptExecutionContext()->allowDatabaseAccess())
     92      permissions |= DatabaseAuthorizer::NoAccessMask;
     93    else if (m_readOnly)
     94      permissions |= DatabaseAuthorizer::ReadOnlyMask;
     95
     96    SQLStatementSync statement(sqlStatement, arguments, permissions);
    9197
    9298    m_database->resetAuthorizer();
  • trunk/WebCore/workers/WorkerContext.h

    r73939 r74093  
    114114
    115115        // Not implemented yet.
    116         virtual bool isDatabaseReadOnly() const { return false; }
     116        virtual bool allowDatabaseAccess() const { return true; }
    117117        // Not implemented for real yet.
    118118        virtual void databaseExceededQuota(const String&);
Note: See TracChangeset for help on using the changeset viewer.