<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[199309] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/199309">199309</a></dd>
<dt>Author</dt> <dd>barraclough@apple.com</dd>
<dt>Date</dt> <dd>2016-04-11 13:10:36 -0700 (Mon, 11 Apr 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>WebKit should adopt journal_mode=wal for all SQLite databases.
https://bugs.webkit.org/show_bug.cgi?id=133496
Reviewed by Darin Adler.
Source/WebCore:
The statement intended to enable WAL mode is always failing because it is missing a
prepare(). Fix this. We were also previously permitting SQLITE_OK results - this
was in error (we were only getting these because stepping the unprepared statement
returned SQLITE_OK). Also set the SQLITE_OPEN_AUTOPROXY flag when opening the
database - this will improve perfomance when the database is accessed via an AFP
mount.
This exposed a bug, that deleteAllDatabases does not actually delete the databases on
iOS, for testing to reset back to a known state between tests it should be doing so.
* Modules/webdatabase/DatabaseTracker.cpp:
(WebCore::DatabaseTracker::deleteAllDatabases):
- force databases to actually be deleted on iOS.
This method is only used from testing code (DumpRenderTree / WebKitTestRunner).
(WebCore::DatabaseTracker::deleteOrigin):
- added IOSDeletionMode.
(WebCore::DatabaseTracker::deleteDatabaseFile):
- added IOSDeletionMode, modified to actually delete if this is set.
* Modules/webdatabase/DatabaseTracker.h:
- added IOSDeletionMode.
* platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::open):
- call prepareAndStep(), only check for SQLITE_ROW result.
* platform/sql/SQLiteFileSystem.cpp:
(WebCore::SQLiteFileSystem::openDatabase):
- should set SQLITE_OPEN_AUTOPROXY flag when opening database.
Source/WebKit/mac:
* Storage/WebDatabaseManagerPrivate.h:
- renamed deleteAllDatabases -> deleteAllDatabasesImmediately.
Source/WebKit/win:
* WebDatabaseManager.cpp:
(WebDatabaseManager::deleteAllDatabases):
- renamed deleteAllDatabases -> deleteAllDatabasesImmediately.
Source/WebKit2:
* WebProcess/InjectedBundle/API/c/WKBundle.cpp:
(WKBundleClearAllDatabases):
- renamed deleteAllDatabases -> deleteAllDatabasesImmediately.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModuleswebdatabaseAbstractDatabaseServerh">trunk/Source/WebCore/Modules/webdatabase/AbstractDatabaseServer.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebdatabaseDatabaseManagercpp">trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebdatabaseDatabaseManagerh">trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebdatabaseDatabaseServercpp">trunk/Source/WebCore/Modules/webdatabase/DatabaseServer.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebdatabaseDatabaseServerh">trunk/Source/WebCore/Modules/webdatabase/DatabaseServer.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebdatabaseDatabaseTrackercpp">trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebdatabaseDatabaseTrackerh">trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.h</a></li>
<li><a href="#trunkSourceWebCoreplatformsqlSQLiteDatabasecpp">trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformsqlSQLiteFileSystemcpp">trunk/Source/WebCore/platform/sql/SQLiteFileSystem.cpp</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacStorageWebDatabaseManagermm">trunk/Source/WebKit/mac/Storage/WebDatabaseManager.mm</a></li>
<li><a href="#trunkSourceWebKitwinChangeLog">trunk/Source/WebKit/win/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitwinWebDatabaseManagercpp">trunk/Source/WebKit/win/WebDatabaseManager.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIcWKBundlecpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (199308 => 199309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-04-11 20:00:31 UTC (rev 199308)
+++ trunk/Source/WebCore/ChangeLog        2016-04-11 20:10:36 UTC (rev 199309)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2016-04-09 Gavin Barraclough <barraclough@apple.com>
+
+ WebKit should adopt journal_mode=wal for all SQLite databases.
+ https://bugs.webkit.org/show_bug.cgi?id=133496
+
+ Reviewed by Darin Adler.
+
+ The statement intended to enable WAL mode is always failing because it is missing a
+ prepare(). Fix this. We were also previously permitting SQLITE_OK results - this
+ was in error (we were only getting these because stepping the unprepared statement
+ returned SQLITE_OK). Also set the SQLITE_OPEN_AUTOPROXY flag when opening the
+ database - this will improve perfomance when the database is accessed via an AFP
+ mount.
+
+ This exposed a bug, that deleteAllDatabases does not actually delete the databases on
+ iOS, for testing to reset back to a known state between tests it should be doing so.
+
+ * Modules/webdatabase/DatabaseTracker.cpp:
+ (WebCore::DatabaseTracker::deleteAllDatabases):
+ - force databases to actually be deleted on iOS.
+ This method is only used from testing code (DumpRenderTree / WebKitTestRunner).
+ (WebCore::DatabaseTracker::deleteOrigin):
+ - added IOSDeletionMode.
+ (WebCore::DatabaseTracker::deleteDatabaseFile):
+ - added IOSDeletionMode, modified to actually delete if this is set.
+ * Modules/webdatabase/DatabaseTracker.h:
+ - added IOSDeletionMode.
+ * platform/sql/SQLiteDatabase.cpp:
+ (WebCore::SQLiteDatabase::open):
+ - call prepareAndStep(), only check for SQLITE_ROW result.
+ * platform/sql/SQLiteFileSystem.cpp:
+ (WebCore::SQLiteFileSystem::openDatabase):
+ - should set SQLITE_OPEN_AUTOPROXY flag when opening database.
+
</ins><span class="cx"> 2016-04-11 Zalan Bujtas <zalan@apple.com>
</span><span class="cx">
</span><span class="cx"> Simplify InlineTextBox::selectionStartEnd()
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebdatabaseAbstractDatabaseServerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webdatabase/AbstractDatabaseServer.h (199308 => 199309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webdatabase/AbstractDatabaseServer.h        2016-04-11 20:00:31 UTC (rev 199308)
+++ trunk/Source/WebCore/Modules/webdatabase/AbstractDatabaseServer.h        2016-04-11 20:10:36 UTC (rev 199309)
</span><span class="lines">@@ -69,7 +69,7 @@
</span><span class="cx">
</span><span class="cx"> virtual void setQuota(SecurityOrigin*, unsigned long long) = 0;
</span><span class="cx">
</span><del>- virtual void deleteAllDatabases() = 0;
</del><ins>+ virtual void deleteAllDatabasesImmediately() = 0;
</ins><span class="cx"> virtual bool deleteOrigin(SecurityOrigin*) = 0;
</span><span class="cx"> virtual bool deleteDatabase(SecurityOrigin*, const String& name) = 0;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebdatabaseDatabaseManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp (199308 => 199309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp        2016-04-11 20:00:31 UTC (rev 199308)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp        2016-04-11 20:10:36 UTC (rev 199309)
</span><span class="lines">@@ -378,9 +378,9 @@
</span><span class="cx"> m_server->setQuota(origin, quotaSize);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void DatabaseManager::deleteAllDatabases()
</del><ins>+void DatabaseManager::deleteAllDatabasesImmediately()
</ins><span class="cx"> {
</span><del>- m_server->deleteAllDatabases();
</del><ins>+ m_server->deleteAllDatabasesImmediately();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool DatabaseManager::deleteOrigin(SecurityOrigin* origin)
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebdatabaseDatabaseManagerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.h (199308 => 199309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.h        2016-04-11 20:00:31 UTC (rev 199308)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.h        2016-04-11 20:10:36 UTC (rev 199309)
</span><span class="lines">@@ -101,7 +101,7 @@
</span><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT void setQuota(SecurityOrigin*, unsigned long long);
</span><span class="cx">
</span><del>- WEBCORE_EXPORT void deleteAllDatabases();
</del><ins>+ WEBCORE_EXPORT void deleteAllDatabasesImmediately();
</ins><span class="cx"> WEBCORE_EXPORT bool deleteOrigin(SecurityOrigin*);
</span><span class="cx"> WEBCORE_EXPORT bool deleteDatabase(SecurityOrigin*, const String& name);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebdatabaseDatabaseServercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseServer.cpp (199308 => 199309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webdatabase/DatabaseServer.cpp        2016-04-11 20:00:31 UTC (rev 199308)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseServer.cpp        2016-04-11 20:10:36 UTC (rev 199309)
</span><span class="lines">@@ -92,9 +92,9 @@
</span><span class="cx"> DatabaseTracker::tracker().setQuota(origin, quotaSize);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void DatabaseServer::deleteAllDatabases()
</del><ins>+void DatabaseServer::deleteAllDatabasesImmediately()
</ins><span class="cx"> {
</span><del>- DatabaseTracker::tracker().deleteAllDatabases();
</del><ins>+ DatabaseTracker::tracker().deleteAllDatabasesImmediately();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool DatabaseServer::deleteOrigin(SecurityOrigin* origin)
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebdatabaseDatabaseServerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseServer.h (199308 => 199309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webdatabase/DatabaseServer.h        2016-04-11 20:00:31 UTC (rev 199308)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseServer.h        2016-04-11 20:10:36 UTC (rev 199309)
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx">
</span><span class="cx"> void setQuota(SecurityOrigin*, unsigned long long) override;
</span><span class="cx">
</span><del>- void deleteAllDatabases() override;
</del><ins>+ void deleteAllDatabasesImmediately() override;
</ins><span class="cx"> bool deleteOrigin(SecurityOrigin*) override;
</span><span class="cx"> bool deleteDatabase(SecurityOrigin*, const String& name) override;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebdatabaseDatabaseTrackercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp (199308 => 199309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp        2016-04-11 20:00:31 UTC (rev 199308)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp        2016-04-11 20:10:36 UTC (rev 199309)
</span><span class="lines">@@ -776,16 +776,13 @@
</span><span class="cx"> LOG_ERROR("Failed to set quota %llu in tracker database for origin %s", quota, origin->databaseIdentifier().ascii().data());
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (m_client)
</del><ins>+ if (m_client) {
</ins><span class="cx"> #if PLATFORM(IOS)
</span><del>- {
</del><span class="cx"> if (insertedNewOrigin)
</span><span class="cx"> m_client->dispatchDidAddNewOrigin(origin);
</span><span class="cx"> #endif
</span><span class="cx"> m_client->dispatchDidModifyOrigin(origin);
</span><del>-#if PLATFORM(IOS)
</del><span class="cx"> }
</span><del>-#endif
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool DatabaseTracker::addDatabase(SecurityOrigin* origin, const String& name, const String& path)
</span><span class="lines">@@ -818,13 +815,17 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void DatabaseTracker::deleteAllDatabases()
</del><ins>+void DatabaseTracker::deleteAllDatabasesImmediately()
</ins><span class="cx"> {
</span><span class="cx"> Vector<RefPtr<SecurityOrigin>> originsCopy;
</span><span class="cx"> origins(originsCopy);
</span><span class="cx">
</span><ins>+ // This method is only intended for use by DumpRenderTree / WebKitTestRunner.
+ // Actually deleting the databases is necessary to reset to a known state before running
+ // each test case, but may be unsafe in deployment use cases (where multiple applications
+ // may be accessing the same databases concurrently).
</ins><span class="cx"> for (auto& origin : originsCopy)
</span><del>- deleteOrigin(origin.get());
</del><ins>+ deleteOrigin(origin.get(), DeletionMode::Immediate);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void DatabaseTracker::deleteDatabasesModifiedSince(std::chrono::system_clock::time_point time)
</span><span class="lines">@@ -862,6 +863,11 @@
</span><span class="cx"> // taking place.
</span><span class="cx"> bool DatabaseTracker::deleteOrigin(SecurityOrigin* origin)
</span><span class="cx"> {
</span><ins>+ return deleteOrigin(origin, DeletionMode::Default);
+}
+
+bool DatabaseTracker::deleteOrigin(SecurityOrigin* origin, DeletionMode deletionMode)
+{
</ins><span class="cx"> Vector<String> databaseNames;
</span><span class="cx"> {
</span><span class="cx"> LockHolder lockDatabase(m_databaseGuard);
</span><span class="lines">@@ -883,7 +889,7 @@
</span><span class="cx">
</span><span class="cx"> // We drop the lock here because holding locks during a call to deleteDatabaseFile will deadlock.
</span><span class="cx"> for (auto& name : databaseNames) {
</span><del>- if (!deleteDatabaseFile(origin, name)) {
</del><ins>+ if (!deleteDatabaseFile(origin, name, deletionMode)) {
</ins><span class="cx"> // Even if the file can't be deleted, we want to try and delete the rest, don't return early here.
</span><span class="cx"> LOG_ERROR("Unable to delete file for database %s in origin %s", name.ascii().data(), origin->databaseIdentifier().ascii().data());
</span><span class="cx"> }
</span><span class="lines">@@ -1084,7 +1090,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // We drop the lock here because holding locks during a call to deleteDatabaseFile will deadlock.
</span><del>- if (!deleteDatabaseFile(origin, name)) {
</del><ins>+ if (!deleteDatabaseFile(origin, name, DeletionMode::Default)) {
</ins><span class="cx"> LOG_ERROR("Unable to delete file for database %s in origin %s", name.ascii().data(), origin->databaseIdentifier().ascii().data());
</span><span class="cx"> LockHolder lockDatabase(m_databaseGuard);
</span><span class="cx"> doneDeletingDatabase(origin, name);
</span><span class="lines">@@ -1123,7 +1129,7 @@
</span><span class="cx">
</span><span class="cx"> // deleteDatabaseFile has to release locks between looking up the list of databases to close and closing them. While this is in progress, the caller
</span><span class="cx"> // is responsible for making sure no new databases are opened in the file to be deleted.
</span><del>-bool DatabaseTracker::deleteDatabaseFile(SecurityOrigin* origin, const String& name)
</del><ins>+bool DatabaseTracker::deleteDatabaseFile(SecurityOrigin* origin, const String& name, DeletionMode deletionMode)
</ins><span class="cx"> {
</span><span class="cx"> String fullPath = fullPathForDatabase(origin, name, false);
</span><span class="cx"> if (fullPath.isEmpty())
</span><span class="lines">@@ -1162,19 +1168,23 @@
</span><span class="cx"> for (auto& database : deletedDatabases)
</span><span class="cx"> database->markAsDeletedAndClose();
</span><span class="cx">
</span><del>-#if !PLATFORM(IOS)
- return SQLiteFileSystem::deleteDatabaseFile(fullPath);
</del><ins>+#if PLATFORM(IOS)
+ if (deletionMode == DeletionMode::Deferred) {
+ // On the phone, other background processes may still be accessing this database. Deleting the database directly
+ // would nuke the POSIX file locks, potentially causing Safari/WebApp to corrupt the new db if it's running in the background.
+ // We'll instead truncate the database file to 0 bytes. If another process is operating on this same database file after
+ // the truncation, it should get an error since the database file is no longer valid. When Safari is launched
+ // next time, it'll go through the database files and clean up any zero-bytes ones.
+ SQLiteDatabase database;
+ if (!database.open(fullPath))
+ return false;
+ return SQLiteFileSystem::truncateDatabaseFile(database.sqlite3Handle());
+ }
</ins><span class="cx"> #else
</span><del>- // On the phone, other background processes may still be accessing this database. Deleting the database directly
- // would nuke the POSIX file locks, potentially causing Safari/WebApp to corrupt the new db if it's running in the background.
- // We'll instead truncate the database file to 0 bytes. If another process is operating on this same database file after
- // the truncation, it should get an error since the database file is no longer valid. When Safari is launched
- // next time, it'll go through the database files and clean up any zero-bytes ones.
- SQLiteDatabase database;
- if (database.open(fullPath))
- return SQLiteFileSystem::truncateDatabaseFile(database.sqlite3Handle());
- return false;
</del><ins>+ UNUSED_PARAM(deletionMode);
</ins><span class="cx"> #endif
</span><ins>+
+ return SQLiteFileSystem::deleteDatabaseFile(fullPath);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebdatabaseDatabaseTrackerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.h (199308 => 199309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.h        2016-04-11 20:00:31 UTC (rev 199308)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.h        2016-04-11 20:10:36 UTC (rev 199309)
</span><span class="lines">@@ -95,7 +95,7 @@
</span><span class="cx"> void setQuota(SecurityOrigin*, unsigned long long);
</span><span class="cx"> RefPtr<OriginLock> originLockFor(SecurityOrigin*);
</span><span class="cx">
</span><del>- void deleteAllDatabases();
</del><ins>+ void deleteAllDatabasesImmediately();
</ins><span class="cx"> WEBCORE_EXPORT void deleteDatabasesModifiedSince(std::chrono::system_clock::time_point);
</span><span class="cx"> WEBCORE_EXPORT bool deleteOrigin(SecurityOrigin*);
</span><span class="cx"> bool deleteDatabase(SecurityOrigin*, const String& name);
</span><span class="lines">@@ -142,8 +142,21 @@
</span><span class="cx">
</span><span class="cx"> bool addDatabase(SecurityOrigin*, const String& name, const String& path);
</span><span class="cx">
</span><del>- bool deleteDatabaseFile(SecurityOrigin*, const String& name);
</del><ins>+ enum class DeletionMode {
+ Immediate,
+#if PLATFORM(IOS)
+ // Deferred deletion is currently only supported on iOS
+ // (see removeDeletedOpenedDatabases etc, above).
+ Deferred,
+ Default = Deferred
+#else
+ Default = Immediate
+#endif
+ };
</ins><span class="cx">
</span><ins>+ bool deleteOrigin(SecurityOrigin*, DeletionMode);
+ bool deleteDatabaseFile(SecurityOrigin*, const String& name, DeletionMode);
+
</ins><span class="cx"> void deleteOriginLockFor(SecurityOrigin*);
</span><span class="cx">
</span><span class="cx"> typedef HashSet<Database*> DatabaseSet;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformsqlSQLiteDatabasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp (199308 => 199309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp        2016-04-11 20:00:31 UTC (rev 199308)
+++ trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp        2016-04-11 20:10:36 UTC (rev 199309)
</span><span class="lines">@@ -116,17 +116,14 @@
</span><span class="cx"> LOG_ERROR("SQLite database could not set temp_store to memory");
</span><span class="cx">
</span><span class="cx"> SQLiteStatement walStatement(*this, ASCIILiteral("PRAGMA journal_mode=WAL;"));
</span><del>- int result = walStatement.step();
- if (result != SQLITE_OK && result != SQLITE_ROW)
- LOG_ERROR("SQLite database failed to set journal_mode to WAL, error: %s", lastErrorMsg());
-
</del><ins>+ if (walStatement.prepareAndStep() == SQLITE_ROW) {
</ins><span class="cx"> #ifndef NDEBUG
</span><del>- if (result == SQLITE_ROW) {
</del><span class="cx"> String mode = walStatement.getColumnText(0);
</span><span class="cx"> if (!equalLettersIgnoringASCIICase(mode, "wal"))
</span><del>- LOG_ERROR("journal_mode of database should be 'wal', but is '%s'", mode.utf8().data());
- }
</del><ins>+ LOG_ERROR("journal_mode of database should be 'WAL', but is '%s'", mode.utf8().data());
</ins><span class="cx"> #endif
</span><ins>+ } else
+ LOG_ERROR("SQLite database failed to set journal_mode to WAL, error: %s", lastErrorMsg());
</ins><span class="cx">
</span><span class="cx"> return isOpen();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformsqlSQLiteFileSystemcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/sql/SQLiteFileSystem.cpp (199308 => 199309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/sql/SQLiteFileSystem.cpp        2016-04-11 20:00:31 UTC (rev 199308)
+++ trunk/Source/WebCore/platform/sql/SQLiteFileSystem.cpp        2016-04-11 20:10:36 UTC (rev 199309)
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx">
</span><span class="cx"> int SQLiteFileSystem::openDatabase(const String& filename, sqlite3** database, bool)
</span><span class="cx"> {
</span><del>- return sqlite3_open(fileSystemRepresentation(filename).data(), database);
</del><ins>+ return sqlite3_open_v2(fileSystemRepresentation(filename).data(), database, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_AUTOPROXY, nullptr);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> String SQLiteFileSystem::appendDatabaseFileNameToPath(const String& path, const String& fileName)
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (199308 => 199309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2016-04-11 20:00:31 UTC (rev 199308)
+++ trunk/Source/WebKit/mac/ChangeLog        2016-04-11 20:10:36 UTC (rev 199309)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2016-04-09 Gavin Barraclough <barraclough@apple.com>
+
+ WebKit should adopt journal_mode=wal for all SQLite databases.
+ https://bugs.webkit.org/show_bug.cgi?id=133496
+
+ Reviewed by Darin Adler.
+
+ * Storage/WebDatabaseManagerPrivate.h:
+ - renamed deleteAllDatabases -> deleteAllDatabasesImmediately.
+
</ins><span class="cx"> 2016-04-05 Oliver Hunt <oliver@apple.com>
</span><span class="cx">
</span><span class="cx"> Remove compile time define for SEPARATED_HEAP
</span></span></pre></div>
<a id="trunkSourceWebKitmacStorageWebDatabaseManagermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Storage/WebDatabaseManager.mm (199308 => 199309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Storage/WebDatabaseManager.mm        2016-04-11 20:00:31 UTC (rev 199308)
+++ trunk/Source/WebKit/mac/Storage/WebDatabaseManager.mm        2016-04-11 20:10:36 UTC (rev 199309)
</span><span class="lines">@@ -133,7 +133,7 @@
</span><span class="cx">
</span><span class="cx"> - (void)deleteAllDatabases
</span><span class="cx"> {
</span><del>- DatabaseManager::singleton().deleteAllDatabases();
</del><ins>+ DatabaseManager::singleton().deleteAllDatabasesImmediately();
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> // FIXME: This needs to be removed once DatabaseTrackers in multiple processes
</span><span class="cx"> // are in sync: <rdar://problem/9567500> Remove Website Data pane is not kept in sync with Safari
</span></span></pre></div>
<a id="trunkSourceWebKitwinChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/ChangeLog (199308 => 199309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/ChangeLog        2016-04-11 20:00:31 UTC (rev 199308)
+++ trunk/Source/WebKit/win/ChangeLog        2016-04-11 20:10:36 UTC (rev 199309)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-04-11 Gavin Barraclough <barraclough@apple.com>
+
+ WebKit should adopt journal_mode=wal for all SQLite databases.
+ https://bugs.webkit.org/show_bug.cgi?id=133496
+
+ Reviewed by Darin Adler.
+
+ * WebDatabaseManager.cpp:
+ (WebDatabaseManager::deleteAllDatabases):
+ - renamed deleteAllDatabases -> deleteAllDatabasesImmediately.
+
</ins><span class="cx"> 2016-04-08 Joanmarie Diggs <jdiggs@igalia.com>
</span><span class="cx">
</span><span class="cx"> AX: "AXLandmarkApplication" is an inappropriate subrole for ARIA "application" since it's no longer a landmark
</span></span></pre></div>
<a id="trunkSourceWebKitwinWebDatabaseManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/WebDatabaseManager.cpp (199308 => 199309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/WebDatabaseManager.cpp        2016-04-11 20:00:31 UTC (rev 199308)
+++ trunk/Source/WebKit/win/WebDatabaseManager.cpp        2016-04-11 20:10:36 UTC (rev 199309)
</span><span class="lines">@@ -285,7 +285,7 @@
</span><span class="cx"> if (this != s_sharedWebDatabaseManager)
</span><span class="cx"> return E_FAIL;
</span><span class="cx">
</span><del>- DatabaseManager::singleton().deleteAllDatabases();
</del><ins>+ DatabaseManager::singleton().deleteAllDatabasesImmediately();
</ins><span class="cx">
</span><span class="cx"> return S_OK;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (199308 => 199309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-04-11 20:00:31 UTC (rev 199308)
+++ trunk/Source/WebKit2/ChangeLog        2016-04-11 20:10:36 UTC (rev 199309)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-04-09 Gavin Barraclough <barraclough@apple.com>
+
+ WebKit should adopt journal_mode=wal for all SQLite databases.
+ https://bugs.webkit.org/show_bug.cgi?id=133496
+
+ Reviewed by Darin Adler.
+
+ * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
+ (WKBundleClearAllDatabases):
+ - renamed deleteAllDatabases -> deleteAllDatabasesImmediately.
+
</ins><span class="cx"> 2016-04-11 Daniel Bates <dabates@apple.com>
</span><span class="cx">
</span><span class="cx"> REGRESSION (r198933): Unable to login to Google account from Internet Accounts preference pane
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIcWKBundlecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp (199308 => 199309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp        2016-04-11 20:00:31 UTC (rev 199308)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp        2016-04-11 20:10:36 UTC (rev 199309)
</span><span class="lines">@@ -202,7 +202,7 @@
</span><span class="cx">
</span><span class="cx"> void WKBundleClearAllDatabases(WKBundleRef)
</span><span class="cx"> {
</span><del>- DatabaseManager::singleton().deleteAllDatabases();
</del><ins>+ DatabaseManager::singleton().deleteAllDatabasesImmediately();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WKBundleSetDatabaseQuota(WKBundleRef bundleRef, uint64_t quota)
</span></span></pre>
</div>
</div>
</body>
</html>