Commit d6794188 authored by shess's avatar shess Committed by Commit bot

[websql] Guard against vfs method deprecation.

In SQLite 3.10.2, the Unix VFS no longer defines unixCurrentTime(),
instead relying on unixCurrentTimeInt64(), which caused a crash in the
implementation of chromiumCurrentTime().  Add assertions to verify
required infrastructure at instantiation rather than first use.

BUG=580948,579743
R=michaeln@chromium.org

Review URL: https://codereview.chromium.org/1639863003

Cr-Commit-Position: refs/heads/master@{#371674}
parent d81338f3
......@@ -303,8 +303,9 @@ int chromiumCurrentTime(sqlite3_vfs* vfs, double* prNow)
int chromiumGetLastError(sqlite3_vfs* vfs, int e, char* s)
{
sqlite3_vfs* wrappedVfs = static_cast<sqlite3_vfs*>(vfs->pAppData);
return wrappedVfs->xGetLastError(wrappedVfs, e, s);
// xGetLastError() has never been used by SQLite. The implementation in os_win.c indicates this is a reasonable implementation.
*s = '\0';
return 0;
}
} // namespace
......@@ -312,6 +313,13 @@ int chromiumGetLastError(sqlite3_vfs* vfs, int e, char* s)
void SQLiteFileSystem::registerSQLiteVFS()
{
sqlite3_vfs* wrappedVfs = sqlite3_vfs_find("unix");
// These are implemented by delegating to |wrappedVfs|.
// TODO(shess): Implement local versions.
ASSERT(wrappedVfs->xRandomness);
ASSERT(wrappedVfs->xSleep);
ASSERT(wrappedVfs->xCurrentTime);
static sqlite3_vfs chromium_vfs = {
1,
sizeof(chromiumVfsFile),
......
......@@ -158,8 +158,9 @@ int chromiumCurrentTime(sqlite3_vfs *vfs, double *prNow)
int chromiumGetLastError(sqlite3_vfs *vfs, int e, char* s)
{
sqlite3_vfs* wrappedVfs = static_cast<sqlite3_vfs*>(vfs->pAppData);
return wrappedVfs->xGetLastError(wrappedVfs, e, s);
// xGetLastError() has never been used by SQLite. The implementation in os_win.c indicates this is a reasonable implementation.
*s = '\0';
return 0;
}
} // namespace
......@@ -167,6 +168,13 @@ int chromiumGetLastError(sqlite3_vfs *vfs, int e, char* s)
void SQLiteFileSystem::registerSQLiteVFS()
{
sqlite3_vfs* wrappedVfs = sqlite3_vfs_find("win32");
// These are implemented by delegating to |wrappedVfs|.
// TODO(shess): Implement local versions.
ASSERT(wrappedVfs->xRandomness);
ASSERT(wrappedVfs->xSleep);
ASSERT(wrappedVfs->xCurrentTime);
static sqlite3_vfs chromium_vfs = {
1,
wrappedVfs->szOsFile,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment