WebKit Bugzilla
Attachment 373588 Details for
Bug 199557
: Fix thread safety issue in Database::scheduleTransactionCallback()
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-199557-20190706170500.patch (text/plain), 27.12 KB, created by
Chris Dumez
on 2019-07-06 17:05:04 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2019-07-06 17:05:04 PDT
Size:
27.12 KB
patch
obsolete
>Subversion Revision: 247182 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 8070eb5295f3ecf81ac26b8fad4c8203467efacf..71084696e08e4f5ebebc8a2c8c0c51277fd95ea7 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,50 @@ >+2019-07-06 Chris Dumez <cdumez@apple.com> >+ >+ Fix thread safety issue in Database::scheduleTransactionCallback() >+ https://bugs.webkit.org/show_bug.cgi?id=199557 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ I am working on adding threading assertions to WeakPtr and found a potentially >+ unsafe call to makeWeakPtr() on a Document from Database::scheduleTransactionCallback() >+ via Document::postTask(), on a background database thread. Document is a main thread >+ object and we should therefore not be interacting with it from a background thread. >+ >+ For clarity, this patch also switches the webdatabase code to use Document instead >+ of ScriptExecution as type since it is only exposed to Window contexts, not workers. >+ >+ * Modules/webdatabase/Database.cpp: >+ (WebCore::Database::Database): >+ (WebCore::Database::~Database): >+ (WebCore::Database::runTransaction): >+ (WebCore::Database::scheduleTransactionCallback): >+ (WebCore::Database::logErrorMessage): >+ (WebCore::Database::securityOrigin): >+ (WebCore::Database::didExceedQuota): >+ * Modules/webdatabase/Database.h: >+ (WebCore::Database::document): >+ * Modules/webdatabase/DatabaseContext.cpp: >+ (WebCore::DatabaseContext::DatabaseContext): >+ * Modules/webdatabase/DatabaseContext.h: >+ * Modules/webdatabase/DatabaseManager.cpp: >+ (WebCore::DatabaseManager::databaseContext): >+ (WebCore::logOpenDatabaseError): >+ (WebCore::DatabaseManager::openDatabaseBackend): >+ (WebCore::DatabaseManager::tryToOpenDatabaseBackend): >+ (WebCore::DatabaseManager::openDatabase): >+ (WebCore::DatabaseManager::hasOpenDatabases): >+ (WebCore::DatabaseManager::stopDatabases): >+ (WebCore::DatabaseManager::logErrorMessage): >+ * Modules/webdatabase/DatabaseManager.h: >+ * Modules/webdatabase/SQLStatement.cpp: >+ (WebCore::SQLStatement::SQLStatement): >+ * Modules/webdatabase/SQLTransaction.cpp: >+ (WebCore::SQLTransaction::SQLTransaction): >+ * inspector/InspectorInstrumentation.h: >+ (WebCore::InspectorInstrumentation::didOpenDatabase): >+ * inspector/agents/InspectorDatabaseAgent.cpp: >+ (WebCore::InspectorDatabaseAgent::executeSQL): >+ > 2019-07-05 Jer Noble <jer.noble@apple.com> > > Revert change to block playback when process is ostensibly "suspended". >diff --git a/Source/WebCore/Modules/webdatabase/Database.cpp b/Source/WebCore/Modules/webdatabase/Database.cpp >index 52b0a08fc3ee658791e61fac9d1f88ea055edc89..02145d0cc2e8c9eadb0c882941b859fc0ae8052d 100644 >--- a/Source/WebCore/Modules/webdatabase/Database.cpp >+++ b/Source/WebCore/Modules/webdatabase/Database.cpp >@@ -193,15 +193,15 @@ static inline DatabaseGUID guidForOriginAndName(const String& origin, const Stri > } > > Database::Database(DatabaseContext& context, const String& name, const String& expectedVersion, const String& displayName, unsigned long long estimatedSize) >- : m_scriptExecutionContext(*context.scriptExecutionContext()) >- , m_contextThreadSecurityOrigin(m_scriptExecutionContext->securityOrigin()->isolatedCopy()) >- , m_databaseThreadSecurityOrigin(m_scriptExecutionContext->securityOrigin()->isolatedCopy()) >+ : m_document(*context.document()) >+ , m_contextThreadSecurityOrigin(m_document->securityOrigin().isolatedCopy()) >+ , m_databaseThreadSecurityOrigin(m_document->securityOrigin().isolatedCopy()) > , m_databaseContext(context) > , m_name((name.isNull() ? emptyString() : name).isolatedCopy()) > , m_expectedVersion(expectedVersion.isolatedCopy()) > , m_displayName(displayName.isolatedCopy()) > , m_estimatedSize(estimatedSize) >- , m_filename(DatabaseManager::singleton().fullPathForDatabase(*m_scriptExecutionContext->securityOrigin(), m_name)) >+ , m_filename(DatabaseManager::singleton().fullPathForDatabase(m_document->securityOrigin(), m_name)) > , m_databaseAuthorizer(DatabaseAuthorizer::create(unqualifiedInfoTableName)) > { > { >@@ -226,14 +226,9 @@ DatabaseThread& Database::databaseThread() > > Database::~Database() > { >- // The reference to the ScriptExecutionContext needs to be cleared on the JavaScript thread. If we're on that thread already, we can just let the RefPtr's destruction do the dereffing. >- if (!m_scriptExecutionContext->isContextThread()) { >- auto passedContext = WTFMove(m_scriptExecutionContext); >- auto& contextRef = passedContext.get(); >- contextRef.postTask({ScriptExecutionContext::Task::CleanupTask, [passedContext = WTFMove(passedContext), databaseContext = WTFMove(m_databaseContext)] (ScriptExecutionContext& context) { >- ASSERT_UNUSED(context, &context == passedContext.ptr()); >- }}); >- } >+ // The reference to the Document needs to be cleared on the JavaScript thread. If we're on that thread already, we can just let the RefPtr's destruction do the dereffing. >+ if (!isMainThread()) >+ callOnMainThread([document = WTFMove(m_document), databaseContext = WTFMove(m_databaseContext)] { }); > > // SQLite is "multi-thread safe", but each database handle can only be used > // on a single thread at a time. >@@ -692,9 +687,8 @@ void Database::runTransaction(RefPtr<SQLTransactionCallback>&& callback, RefPtr< > LockHolder locker(m_transactionInProgressMutex); > if (!m_isTransactionQueueEnabled) { > if (errorCallback) { >- RefPtr<SQLTransactionErrorCallback> errorCallbackProtector = WTFMove(errorCallback); >- m_scriptExecutionContext->postTask([errorCallbackProtector](ScriptExecutionContext&) { >- errorCallbackProtector->handleEvent(SQLError::create(SQLError::UNKNOWN_ERR, "database has been closed")); >+ callOnMainThread([errorCallback = makeRef(*errorCallback)]() { >+ errorCallback->handleEvent(SQLError::create(SQLError::UNKNOWN_ERR, "database has been closed")); > }); > } > return; >@@ -707,9 +701,8 @@ void Database::runTransaction(RefPtr<SQLTransactionCallback>&& callback, RefPtr< > > void Database::scheduleTransactionCallback(SQLTransaction* transaction) > { >- RefPtr<SQLTransaction> transactionProtector(transaction); >- m_scriptExecutionContext->postTask([transactionProtector] (ScriptExecutionContext&) { >- transactionProtector->performPendingCallback(); >+ callOnMainThread([transaction = makeRefPtr(transaction)] { >+ transaction->performPendingCallback(); > }); > } > >@@ -757,7 +750,7 @@ void Database::incrementalVacuumIfNeeded() > > void Database::logErrorMessage(const String& message) > { >- m_scriptExecutionContext->addConsoleMessage(MessageSource::Storage, MessageLevel::Error, message); >+ m_document->addConsoleMessage(MessageSource::Storage, MessageLevel::Error, message); > } > > Vector<String> Database::tableNames() >@@ -779,7 +772,7 @@ Vector<String> Database::tableNames() > > SecurityOriginData Database::securityOrigin() > { >- if (m_scriptExecutionContext->isContextThread()) >+ if (isMainThread()) > return m_contextThreadSecurityOrigin->data(); > if (databaseThread().getThread() == &Thread::current()) > return m_databaseThreadSecurityOrigin->data(); >@@ -798,7 +791,7 @@ void Database::didCommitWriteTransaction() > > bool Database::didExceedQuota() > { >- ASSERT(databaseContext().scriptExecutionContext()->isContextThread()); >+ ASSERT(isMainThread()); > auto& tracker = DatabaseTracker::singleton(); > auto oldQuota = tracker.quota(securityOrigin()); > if (estimatedSize() <= oldQuota) { >diff --git a/Source/WebCore/Modules/webdatabase/Database.h b/Source/WebCore/Modules/webdatabase/Database.h >index 2bdde1d6891ff22a3fe9f54ee9d3752689b73078..97b966c4f7722282dfb405398440a25f435995db 100644 >--- a/Source/WebCore/Modules/webdatabase/Database.h >+++ b/Source/WebCore/Modules/webdatabase/Database.h >@@ -39,7 +39,7 @@ class DatabaseCallback; > class DatabaseContext; > class DatabaseDetails; > class DatabaseThread; >-class ScriptExecutionContext; >+class Document; > class SecurityOrigin; > class SQLTransaction; > class SQLTransactionBackend; >@@ -105,7 +105,7 @@ public: > > DatabaseContext& databaseContext() { return m_databaseContext; } > DatabaseThread& databaseThread(); >- ScriptExecutionContext& scriptExecutionContext() { return m_scriptExecutionContext; } >+ Document& document() { return m_document; } > void logErrorMessage(const String& message); > > Vector<String> tableNames(); >@@ -147,7 +147,7 @@ private: > String databaseDebugName() const; > #endif > >- Ref<ScriptExecutionContext> m_scriptExecutionContext; >+ Ref<Document> m_document; > Ref<SecurityOrigin> m_contextThreadSecurityOrigin; > Ref<SecurityOrigin> m_databaseThreadSecurityOrigin; > Ref<DatabaseContext> m_databaseContext; >diff --git a/Source/WebCore/Modules/webdatabase/DatabaseContext.cpp b/Source/WebCore/Modules/webdatabase/DatabaseContext.cpp >index 497131c270b4988c280612364de4e92c7bda4f98..482204e5ac2454bb9ba31b0afb8017ab3ea66c9b 100644 >--- a/Source/WebCore/Modules/webdatabase/DatabaseContext.cpp >+++ b/Source/WebCore/Modules/webdatabase/DatabaseContext.cpp >@@ -94,14 +94,14 @@ namespace WebCore { > // DatabaseContext will outlive both regardless of which of the 2 destructs first. > > >-DatabaseContext::DatabaseContext(ScriptExecutionContext& context) >- : ActiveDOMObject(&context) >+DatabaseContext::DatabaseContext(Document& document) >+ : ActiveDOMObject(document) > { > // ActiveDOMObject expects this to be called to set internal flags. > suspendIfNeeded(); > >- ASSERT(!context.databaseContext()); >- context.setDatabaseContext(this); >+ ASSERT(!document.databaseContext()); >+ document.setDatabaseContext(this); > } > > DatabaseContext::~DatabaseContext() >diff --git a/Source/WebCore/Modules/webdatabase/DatabaseContext.h b/Source/WebCore/Modules/webdatabase/DatabaseContext.h >index 4f52d7a5fa4223ecb8a3646f0b2cacd1c453322a..827a01e7cfbfc3a68a948703d0436b3378c5b6e5 100644 >--- a/Source/WebCore/Modules/webdatabase/DatabaseContext.h >+++ b/Source/WebCore/Modules/webdatabase/DatabaseContext.h >@@ -60,13 +60,13 @@ public: > bool allowDatabaseAccess() const; > void databaseExceededQuota(const String& name, DatabaseDetails); > >- using ActiveDOMObject::scriptExecutionContext; >+ Document* document() const { return downcast<Document>(ActiveDOMObject::scriptExecutionContext()); } > const SecurityOriginData& securityOrigin() const; > > bool isContextThread() const; > > private: >- explicit DatabaseContext(ScriptExecutionContext&); >+ explicit DatabaseContext(Document&); > > void stopDatabases() { stopDatabases(nullptr); } > >diff --git a/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp b/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp >index 339409b616c3c043b5eb5d893f9370819c8bea7f..05dfa3792d440c6a31edf9b881dbdf198e7b8c46 100644 >--- a/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp >+++ b/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp >@@ -31,11 +31,11 @@ > #include "DatabaseContext.h" > #include "DatabaseTask.h" > #include "DatabaseTracker.h" >+#include "Document.h" > #include "InspectorInstrumentation.h" > #include "Logging.h" > #include "PlatformStrategies.h" > #include "ScriptController.h" >-#include "ScriptExecutionContext.h" > #include "SecurityOrigin.h" > #include "SecurityOriginData.h" > #include <wtf/NeverDestroyed.h> >@@ -97,31 +97,31 @@ void DatabaseManager::setIsAvailable(bool available) > m_databaseIsAvailable = available; > } > >-Ref<DatabaseContext> DatabaseManager::databaseContext(ScriptExecutionContext& context) >+Ref<DatabaseContext> DatabaseManager::databaseContext(Document& document) > { >- if (auto databaseContext = context.databaseContext()) >+ if (auto databaseContext = document.databaseContext()) > return *databaseContext; >- return adoptRef(*new DatabaseContext(context)); >+ return adoptRef(*new DatabaseContext(document)); > } > > #if LOG_DISABLED > >-static inline void logOpenDatabaseError(ScriptExecutionContext&, const String&) >+static inline void logOpenDatabaseError(Document&, const String&) > { > } > > #else > >-static void logOpenDatabaseError(ScriptExecutionContext& context, const String& name) >+static void logOpenDatabaseError(Document& document, const String& name) > { >- LOG(StorageAPI, "Database %s for origin %s not allowed to be established", name.utf8().data(), context.securityOrigin()->toString().utf8().data()); >+ LOG(StorageAPI, "Database %s for origin %s not allowed to be established", name.utf8().data(), document.securityOrigin().toString().utf8().data()); > } > > #endif > >-ExceptionOr<Ref<Database>> DatabaseManager::openDatabaseBackend(ScriptExecutionContext& context, const String& name, const String& expectedVersion, const String& displayName, unsigned estimatedSize, bool setVersionInNewDatabase) >+ExceptionOr<Ref<Database>> DatabaseManager::openDatabaseBackend(Document& document, const String& name, const String& expectedVersion, const String& displayName, unsigned estimatedSize, bool setVersionInNewDatabase) > { >- auto backend = tryToOpenDatabaseBackend(context, name, expectedVersion, displayName, estimatedSize, setVersionInNewDatabase, FirstTryToOpenDatabase); >+ auto backend = tryToOpenDatabaseBackend(document, name, expectedVersion, displayName, estimatedSize, setVersionInNewDatabase, FirstTryToOpenDatabase); > > if (backend.hasException()) { > if (backend.exception().code() == QuotaExceededError) { >@@ -129,39 +129,31 @@ ExceptionOr<Ref<Database>> DatabaseManager::openDatabaseBackend(ScriptExecutionC > // The client may want to increase the quota, and we'll give it > // one more try after if that is the case. > { >- // FIXME: What guarantees context.securityOrigin() is non-null? >- ProposedDatabase proposedDatabase { *this, *context.securityOrigin(), name, displayName, estimatedSize }; >- this->databaseContext(context)->databaseExceededQuota(name, proposedDatabase.details()); >+ ProposedDatabase proposedDatabase { *this, document.securityOrigin(), name, displayName, estimatedSize }; >+ this->databaseContext(document)->databaseExceededQuota(name, proposedDatabase.details()); > } >- backend = tryToOpenDatabaseBackend(context, name, expectedVersion, displayName, estimatedSize, setVersionInNewDatabase, RetryOpenDatabase); >+ backend = tryToOpenDatabaseBackend(document, name, expectedVersion, displayName, estimatedSize, setVersionInNewDatabase, RetryOpenDatabase); > } > } > > if (backend.hasException()) { > if (backend.exception().code() == InvalidStateError) >- logErrorMessage(context, backend.exception().message()); >+ logErrorMessage(document, backend.exception().message()); > else >- logOpenDatabaseError(context, name); >+ logOpenDatabaseError(document, name); > } > > return backend; > } > >-ExceptionOr<Ref<Database>> DatabaseManager::tryToOpenDatabaseBackend(ScriptExecutionContext& scriptContext, const String& name, const String& expectedVersion, const String& displayName, unsigned estimatedSize, bool setVersionInNewDatabase, >+ExceptionOr<Ref<Database>> DatabaseManager::tryToOpenDatabaseBackend(Document& document, const String& name, const String& expectedVersion, const String& displayName, unsigned estimatedSize, bool setVersionInNewDatabase, > OpenAttempt attempt) > { >- if (is<Document>(&scriptContext)) { >- auto* page = downcast<Document>(scriptContext).page(); >- if (!page || page->usesEphemeralSession()) >- return Exception { SecurityError }; >- } >- >- if (scriptContext.isWorkerGlobalScope()) { >- ASSERT_NOT_REACHED(); >+ auto* page = document.page(); >+ if (!page || page->usesEphemeralSession()) > return Exception { SecurityError }; >- } > >- auto backendContext = this->databaseContext(scriptContext); >+ auto backendContext = this->databaseContext(document); > > ExceptionOr<void> preflightResult; > switch (attempt) { >@@ -198,25 +190,25 @@ void DatabaseManager::removeProposedDatabase(ProposedDatabase& database) > m_proposedDatabases.remove(&database); > } > >-ExceptionOr<Ref<Database>> DatabaseManager::openDatabase(ScriptExecutionContext& context, const String& name, const String& expectedVersion, const String& displayName, unsigned estimatedSize, RefPtr<DatabaseCallback>&& creationCallback) >+ExceptionOr<Ref<Database>> DatabaseManager::openDatabase(Document& document, const String& name, const String& expectedVersion, const String& displayName, unsigned estimatedSize, RefPtr<DatabaseCallback>&& creationCallback) > { > ScriptController::initializeThreading(); > > bool setVersionInNewDatabase = !creationCallback; >- auto openResult = openDatabaseBackend(context, name, expectedVersion, displayName, estimatedSize, setVersionInNewDatabase); >+ auto openResult = openDatabaseBackend(document, name, expectedVersion, displayName, estimatedSize, setVersionInNewDatabase); > if (openResult.hasException()) > return openResult.releaseException(); > > RefPtr<Database> database = openResult.releaseReturnValue(); > >- auto databaseContext = this->databaseContext(context); >+ auto databaseContext = this->databaseContext(document); > databaseContext->setHasOpenDatabases(); > InspectorInstrumentation::didOpenDatabase(*database); > > if (database->isNew() && creationCallback.get()) { > LOG(StorageAPI, "Scheduling DatabaseCreationCallbackTask for database %p\n", database.get()); > database->setHasPendingCreationEvent(true); >- database->m_scriptExecutionContext->postTask([creationCallback, database] (ScriptExecutionContext&) { >+ database->m_document->postTask([creationCallback, database] (ScriptExecutionContext&) { > creationCallback->handleEvent(*database); > database->setHasPendingCreationEvent(false); > }); >@@ -225,15 +217,15 @@ ExceptionOr<Ref<Database>> DatabaseManager::openDatabase(ScriptExecutionContext& > return database.releaseNonNull(); > } > >-bool DatabaseManager::hasOpenDatabases(ScriptExecutionContext& context) >+bool DatabaseManager::hasOpenDatabases(Document& document) > { >- auto databaseContext = context.databaseContext(); >+ auto databaseContext = document.databaseContext(); > return databaseContext && databaseContext->hasOpenDatabases(); > } > >-void DatabaseManager::stopDatabases(ScriptExecutionContext& context, DatabaseTaskSynchronizer* synchronizer) >+void DatabaseManager::stopDatabases(Document& document, DatabaseTaskSynchronizer* synchronizer) > { >- auto databaseContext = context.databaseContext(); >+ auto databaseContext = document.databaseContext(); > if (!databaseContext || !databaseContext->stopDatabases(synchronizer)) { > if (synchronizer) > synchronizer->taskCompleted(); >@@ -267,9 +259,9 @@ DatabaseDetails DatabaseManager::detailsForNameAndOrigin(const String& name, Sec > return DatabaseTracker::singleton().detailsForNameAndOrigin(name, origin.data()); > } > >-void DatabaseManager::logErrorMessage(ScriptExecutionContext& context, const String& message) >+void DatabaseManager::logErrorMessage(Document& document, const String& message) > { >- context.addConsoleMessage(MessageSource::Storage, MessageLevel::Error, message); >+ document.addConsoleMessage(MessageSource::Storage, MessageLevel::Error, message); > } > > #if !PLATFORM(COCOA) >diff --git a/Source/WebCore/Modules/webdatabase/DatabaseManager.h b/Source/WebCore/Modules/webdatabase/DatabaseManager.h >index 91322e5a223d24b9456257855327222aad16e7ae..aa43ebef89c2884b1178c2f9ffe9f1bf01fa881b 100644 >--- a/Source/WebCore/Modules/webdatabase/DatabaseManager.h >+++ b/Source/WebCore/Modules/webdatabase/DatabaseManager.h >@@ -38,9 +38,9 @@ class DatabaseCallback; > class DatabaseContext; > class DatabaseManagerClient; > class DatabaseTaskSynchronizer; >+class Document; > class Exception; > class SecurityOrigin; >-class ScriptExecutionContext; > struct SecurityOriginData; > > class DatabaseManager { >@@ -55,14 +55,14 @@ public: > bool isAvailable(); > WEBCORE_EXPORT void setIsAvailable(bool); > >- // This gets a DatabaseContext for the specified ScriptExecutionContext. >+ // This gets a DatabaseContext for the specified Document. > // If one doesn't already exist, it will create a new one. >- Ref<DatabaseContext> databaseContext(ScriptExecutionContext&); >+ Ref<DatabaseContext> databaseContext(Document&); > >- ExceptionOr<Ref<Database>> openDatabase(ScriptExecutionContext&, const String& name, const String& expectedVersion, const String& displayName, unsigned estimatedSize, RefPtr<DatabaseCallback>&&); >+ ExceptionOr<Ref<Database>> openDatabase(Document&, const String& name, const String& expectedVersion, const String& displayName, unsigned estimatedSize, RefPtr<DatabaseCallback>&&); > >- WEBCORE_EXPORT bool hasOpenDatabases(ScriptExecutionContext&); >- void stopDatabases(ScriptExecutionContext&, DatabaseTaskSynchronizer*); >+ WEBCORE_EXPORT bool hasOpenDatabases(Document&); >+ void stopDatabases(Document&, DatabaseTaskSynchronizer*); > > WEBCORE_EXPORT String fullPathForDatabase(SecurityOrigin&, const String& name, bool createIfDoesNotExist = true); > >@@ -75,14 +75,14 @@ private: > void platformInitialize(const String& databasePath); > > enum OpenAttempt { FirstTryToOpenDatabase, RetryOpenDatabase }; >- ExceptionOr<Ref<Database>> openDatabaseBackend(ScriptExecutionContext&, const String& name, const String& expectedVersion, const String& displayName, unsigned estimatedSize, bool setVersionInNewDatabase); >- ExceptionOr<Ref<Database>> tryToOpenDatabaseBackend(ScriptExecutionContext&, const String& name, const String& expectedVersion, const String& displayName, unsigned estimatedSize, bool setVersionInNewDatabase, OpenAttempt); >+ ExceptionOr<Ref<Database>> openDatabaseBackend(Document&, const String& name, const String& expectedVersion, const String& displayName, unsigned estimatedSize, bool setVersionInNewDatabase); >+ ExceptionOr<Ref<Database>> tryToOpenDatabaseBackend(Document&, const String& name, const String& expectedVersion, const String& displayName, unsigned estimatedSize, bool setVersionInNewDatabase, OpenAttempt); > > class ProposedDatabase; > void addProposedDatabase(ProposedDatabase&); > void removeProposedDatabase(ProposedDatabase&); > >- static void logErrorMessage(ScriptExecutionContext&, const String& message); >+ static void logErrorMessage(Document&, const String& message); > > DatabaseManagerClient* m_client { nullptr }; > bool m_databaseIsAvailable { true }; >diff --git a/Source/WebCore/Modules/webdatabase/SQLStatement.cpp b/Source/WebCore/Modules/webdatabase/SQLStatement.cpp >index 7e13d060b3516d25e0b23c9dd6404f7ab0635bb2..4c296158ad29dbce5f0506dcce67129a1c3a95d1 100644 >--- a/Source/WebCore/Modules/webdatabase/SQLStatement.cpp >+++ b/Source/WebCore/Modules/webdatabase/SQLStatement.cpp >@@ -29,6 +29,7 @@ > #include "SQLStatement.h" > > #include "Database.h" >+#include "Document.h" > #include "Logging.h" > #include "SQLError.h" > #include "SQLResultSet.h" >@@ -77,8 +78,8 @@ namespace WebCore { > SQLStatement::SQLStatement(Database& database, const String& statement, Vector<SQLValue>&& arguments, RefPtr<SQLStatementCallback>&& callback, RefPtr<SQLStatementErrorCallback>&& errorCallback, int permissions) > : m_statement(statement.isolatedCopy()) > , m_arguments(WTFMove(arguments)) >- , m_statementCallbackWrapper(WTFMove(callback), &database.scriptExecutionContext()) >- , m_statementErrorCallbackWrapper(WTFMove(errorCallback), &database.scriptExecutionContext()) >+ , m_statementCallbackWrapper(WTFMove(callback), &database.document()) >+ , m_statementErrorCallbackWrapper(WTFMove(errorCallback), &database.document()) > , m_permissions(permissions) > { > } >diff --git a/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp b/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp >index a19c776566e9733511d2385e2bcffd0a90915525..20d69734774dbfbf30bd8f39ce4c5957214e900c 100644 >--- a/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp >+++ b/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp >@@ -34,6 +34,7 @@ > #include "DatabaseContext.h" > #include "DatabaseThread.h" > #include "DatabaseTracker.h" >+#include "Document.h" > #include "Logging.h" > #include "OriginLock.h" > #include "SQLError.h" >@@ -59,9 +60,9 @@ Ref<SQLTransaction> SQLTransaction::create(Ref<Database>&& database, RefPtr<SQLT > > SQLTransaction::SQLTransaction(Ref<Database>&& database, RefPtr<SQLTransactionCallback>&& callback, RefPtr<VoidCallback>&& successCallback, RefPtr<SQLTransactionErrorCallback>&& errorCallback, RefPtr<SQLTransactionWrapper>&& wrapper, bool readOnly) > : m_database(WTFMove(database)) >- , m_callbackWrapper(WTFMove(callback), &m_database->scriptExecutionContext()) >- , m_successCallbackWrapper(WTFMove(successCallback), &m_database->scriptExecutionContext()) >- , m_errorCallbackWrapper(WTFMove(errorCallback), &m_database->scriptExecutionContext()) >+ , m_callbackWrapper(WTFMove(callback), &m_database->document()) >+ , m_successCallbackWrapper(WTFMove(successCallback), &m_database->document()) >+ , m_errorCallbackWrapper(WTFMove(errorCallback), &m_database->document()) > , m_wrapper(WTFMove(wrapper)) > , m_nextStep(&SQLTransaction::acquireLock) > , m_readOnly(readOnly) >diff --git a/Source/WebCore/inspector/InspectorInstrumentation.h b/Source/WebCore/inspector/InspectorInstrumentation.h >index b2d15ce86ddad6dcbbceeb442a5c926c64cc3fc6..9791a8650b499f4b0bf5fbad3cb8aa6d360ee273 100644 >--- a/Source/WebCore/inspector/InspectorInstrumentation.h >+++ b/Source/WebCore/inspector/InspectorInstrumentation.h >@@ -1201,7 +1201,7 @@ inline void InspectorInstrumentation::willDestroyCachedResource(CachedResource& > inline void InspectorInstrumentation::didOpenDatabase(Database& database) > { > FAST_RETURN_IF_NO_FRONTENDS(void()); >- if (auto* instrumentingAgents = instrumentingAgentsForContext(database.scriptExecutionContext())) >+ if (auto* instrumentingAgents = instrumentingAgentsForContext(database.document())) > didOpenDatabaseImpl(*instrumentingAgents, database); > } > >diff --git a/Source/WebCore/inspector/agents/InspectorDatabaseAgent.cpp b/Source/WebCore/inspector/agents/InspectorDatabaseAgent.cpp >index 5f730b0d4a8512d0ebd5266299497cef42d4760a..c821e062d0d6b4881658df2914745e1f7904b22e 100644 >--- a/Source/WebCore/inspector/agents/InspectorDatabaseAgent.cpp >+++ b/Source/WebCore/inspector/agents/InspectorDatabaseAgent.cpp >@@ -278,9 +278,9 @@ void InspectorDatabaseAgent::executeSQL(const String& databaseId, const String& > return; > } > >- database->transaction(TransactionCallback::create(&database->scriptExecutionContext(), query, requestCallback.copyRef()), >- TransactionErrorCallback::create(&database->scriptExecutionContext(), requestCallback.copyRef()), >- TransactionSuccessCallback::create(&database->scriptExecutionContext())); >+ database->transaction(TransactionCallback::create(&database->document(), query, requestCallback.copyRef()), >+ TransactionErrorCallback::create(&database->document(), requestCallback.copyRef()), >+ TransactionSuccessCallback::create(&database->document())); > } > > String InspectorDatabaseAgent::databaseId(Database& database)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 199557
:
373587
| 373588