Diff
Modified: trunk/Source/WebCore/ChangeLog (247218 => 247219)
--- trunk/Source/WebCore/ChangeLog 2019-07-08 18:26:47 UTC (rev 247218)
+++ trunk/Source/WebCore/ChangeLog 2019-07-08 18:38:32 UTC (rev 247219)
@@ -1,5 +1,52 @@
2019-07-08 Chris Dumez <[email protected]>
+ Fix thread safety issue in Database::scheduleTransactionCallback()
+ https://bugs.webkit.org/show_bug.cgi?id=199557
+
+ Reviewed by Alex Christensen.
+
+ 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-08 Chris Dumez <[email protected]>
+
Add threading assertion to WTF::CompletionHandler
https://bugs.webkit.org/show_bug.cgi?id=199516
Modified: trunk/Source/WebCore/Modules/webdatabase/Database.cpp (247218 => 247219)
--- trunk/Source/WebCore/Modules/webdatabase/Database.cpp 2019-07-08 18:26:47 UTC (rev 247218)
+++ trunk/Source/WebCore/Modules/webdatabase/Database.cpp 2019-07-08 18:38:32 UTC (rev 247219)
@@ -193,15 +193,15 @@
}
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 @@
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 @@
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::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::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 @@
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 @@
bool Database::didExceedQuota()
{
- ASSERT(databaseContext().scriptExecutionContext()->isContextThread());
+ ASSERT(isMainThread());
auto& tracker = DatabaseTracker::singleton();
auto oldQuota = tracker.quota(securityOrigin());
if (estimatedSize() <= oldQuota) {
Modified: trunk/Source/WebCore/Modules/webdatabase/Database.h (247218 => 247219)
--- trunk/Source/WebCore/Modules/webdatabase/Database.h 2019-07-08 18:26:47 UTC (rev 247218)
+++ trunk/Source/WebCore/Modules/webdatabase/Database.h 2019-07-08 18:38:32 UTC (rev 247219)
@@ -39,7 +39,7 @@
class DatabaseContext;
class DatabaseDetails;
class DatabaseThread;
-class ScriptExecutionContext;
+class Document;
class SecurityOrigin;
class SQLTransaction;
class SQLTransactionBackend;
@@ -105,7 +105,7 @@
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 @@
String databaseDebugName() const;
#endif
- Ref<ScriptExecutionContext> m_scriptExecutionContext;
+ Ref<Document> m_document;
Ref<SecurityOrigin> m_contextThreadSecurityOrigin;
Ref<SecurityOrigin> m_databaseThreadSecurityOrigin;
Ref<DatabaseContext> m_databaseContext;
Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseContext.cpp (247218 => 247219)
--- trunk/Source/WebCore/Modules/webdatabase/DatabaseContext.cpp 2019-07-08 18:26:47 UTC (rev 247218)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseContext.cpp 2019-07-08 18:38:32 UTC (rev 247219)
@@ -94,14 +94,14 @@
// 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()
Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseContext.h (247218 => 247219)
--- trunk/Source/WebCore/Modules/webdatabase/DatabaseContext.h 2019-07-08 18:26:47 UTC (rev 247218)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseContext.h 2019-07-08 18:38:32 UTC (rev 247219)
@@ -60,13 +60,13 @@
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); }
Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp (247218 => 247219)
--- trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp 2019-07-08 18:26:47 UTC (rev 247218)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp 2019-07-08 18:38:32 UTC (rev 247219)
@@ -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 @@
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 @@
// 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,18 +190,18 @@
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);
@@ -216,7 +208,7 @@
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 @@
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 @@
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)
Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.h (247218 => 247219)
--- trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.h 2019-07-08 18:26:47 UTC (rev 247218)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.h 2019-07-08 18:38:32 UTC (rev 247219)
@@ -38,9 +38,9 @@
class DatabaseContext;
class DatabaseManagerClient;
class DatabaseTaskSynchronizer;
+class Document;
class Exception;
class SecurityOrigin;
-class ScriptExecutionContext;
struct SecurityOriginData;
class DatabaseManager {
@@ -55,14 +55,14 @@
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 @@
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 };
Modified: trunk/Source/WebCore/Modules/webdatabase/SQLStatement.cpp (247218 => 247219)
--- trunk/Source/WebCore/Modules/webdatabase/SQLStatement.cpp 2019-07-08 18:26:47 UTC (rev 247218)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLStatement.cpp 2019-07-08 18:38:32 UTC (rev 247219)
@@ -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 @@
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)
{
}
Modified: trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp (247218 => 247219)
--- trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp 2019-07-08 18:26:47 UTC (rev 247218)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp 2019-07-08 18:38:32 UTC (rev 247219)
@@ -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 @@
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)
Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (247218 => 247219)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2019-07-08 18:26:47 UTC (rev 247218)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2019-07-08 18:38:32 UTC (rev 247219)
@@ -1201,7 +1201,7 @@
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);
}
Modified: trunk/Source/WebCore/inspector/agents/InspectorDatabaseAgent.cpp (247218 => 247219)
--- trunk/Source/WebCore/inspector/agents/InspectorDatabaseAgent.cpp 2019-07-08 18:26:47 UTC (rev 247218)
+++ trunk/Source/WebCore/inspector/agents/InspectorDatabaseAgent.cpp 2019-07-08 18:38:32 UTC (rev 247219)
@@ -278,9 +278,9 @@
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)