Commit fb077e5f authored by levin@chromium.org's avatar levin@chromium.org

2010-03-03 David Levin <levin@chromium.org>

        No review, rolling out r55474.
        http://trac.webkit.org/changeset/55480

        The patch broke fast/frames/sandboxed-iframe-storage.html

        * Android.jscbindings.mk:
        * Android.v8bindings.mk:
        * GNUmakefile.am:
        * WebCore.gypi:
        * WebCore.pro:
        * WebCore.vcproj/WebCore.vcproj:
        * bindings/js/JSDOMWindowCustom.cpp:
        * bindings/v8/custom/V8DOMWindowCustom.cpp:
        * dom/Document.cpp:
        (WebCore::Document::postTask):
        * page/DOMWindow.cpp:
        (WebCore::DOMWindow::openDatabase):
        * page/DOMWindow.h:
        * page/DOMWindow.idl:
        * storage/Database.cpp:
        (WebCore::Database::openDatabase):
        (WebCore::Database::Database):
        (WebCore::Database::performOpenAndVerify):
        * storage/Database.h:
        * workers/WorkerContext.cpp:
        (WebCore::WorkerContext::openDatabase):
        * workers/WorkerContext.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55485 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1bc093fb
......@@ -80,7 +80,6 @@ LOCAL_SRC_FILES += \
bindings/js/JSCustomSQLTransactionCallback.cpp \
bindings/js/JSCustomSQLTransactionErrorCallback.cpp \
bindings/js/JSCustomVoidCallback.cpp \
bindings/js/JSDatabaseCallback.cpp \
bindings/js/JSDesktopNotificationsCustom.cpp \
bindings/js/JSDOMApplicationCacheCustom.cpp \
bindings/js/JSDOMBinding.cpp \
......
......@@ -108,7 +108,6 @@ LOCAL_SRC_FILES += \
bindings/v8/custom/V8DOMSelectionCustom.cpp \
bindings/v8/custom/V8DOMWindowCustom.cpp \
bindings/v8/custom/V8DataGridColumnListCustom.cpp \
bindings/v8/custom/V8DatabaseCallback.cpp \
bindings/v8/custom/V8DatabaseCustom.cpp \
bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp \
bindings/v8/custom/V8DocumentCustom.cpp \
......
2010-03-03 David Levin <levin@chromium.org>
No review, rolling out r55474.
http://trac.webkit.org/changeset/55480
The patch broke fast/frames/sandboxed-iframe-storage.html
* Android.jscbindings.mk:
* Android.v8bindings.mk:
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* bindings/js/JSDOMWindowCustom.cpp:
* bindings/v8/custom/V8DOMWindowCustom.cpp:
* dom/Document.cpp:
(WebCore::Document::postTask):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::openDatabase):
* page/DOMWindow.h:
* page/DOMWindow.idl:
* storage/Database.cpp:
(WebCore::Database::openDatabase):
(WebCore::Database::Database):
(WebCore::Database::performOpenAndVerify):
* storage/Database.h:
* workers/WorkerContext.cpp:
(WebCore::WorkerContext::openDatabase):
* workers/WorkerContext.h:
2010-03-03 David Levin <levin@chromium.org>
No review, rolling out r55480.
......
......@@ -2228,8 +2228,6 @@ webcore_sources += \
WebCore/bindings/js/JSCustomSQLTransactionCallback.h \
WebCore/bindings/js/JSCustomSQLTransactionErrorCallback.cpp \
WebCore/bindings/js/JSCustomSQLTransactionErrorCallback.h \
WebCore/bindings/js/JSDatabaseCallback.cpp \
WebCore/bindings/js/JSDatabaseCallback.h \
WebCore/bindings/js/JSDatabaseCustom.cpp \
WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp \
WebCore/bindings/js/JSSQLTransactionCustom.cpp \
......@@ -2250,7 +2248,6 @@ webcore_sources += \
WebCore/storage/Database.h \
WebCore/storage/DatabaseAuthorizer.cpp \
WebCore/storage/DatabaseAuthorizer.h \
WebCore/storage/DatabaseCallback.h \
WebCore/storage/DatabaseDetails.h \
WebCore/storage/DatabaseTask.cpp \
WebCore/storage/DatabaseTask.h \
......
......@@ -703,8 +703,6 @@
'bindings/v8/custom/V8CustomVoidCallback.h',
'bindings/v8/custom/V8CustomXPathNSResolver.cpp',
'bindings/v8/custom/V8CustomXPathNSResolver.h',
'bindings/v8/custom/V8DatabaseCallback.cpp',
'bindings/v8/custom/V8DatabaseCallback.h',
'bindings/v8/custom/V8DatabaseCustom.cpp',
'bindings/v8/custom/V8DataGridColumnListCustom.cpp',
'bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp',
......@@ -3220,7 +3218,6 @@
'storage/Database.h',
'storage/DatabaseAuthorizer.cpp',
'storage/DatabaseAuthorizer.h',
'storage/DatabaseCallback.h',
'storage/DatabaseDetails.h',
'storage/DatabaseTask.cpp',
'storage/DatabaseTask.h',
......
......@@ -1012,7 +1012,6 @@ HEADERS += \
bindings/js/JSCustomSQLTransactionErrorCallback.h \
bindings/js/JSCustomVoidCallback.h \
bindings/js/JSCustomXPathNSResolver.h \
bindings/js/JSDatabaseCallback.h \
bindings/js/JSDataGridDataSource.h \
bindings/js/JSDOMBinding.h \
bindings/js/JSDOMGlobalObject.h \
......@@ -2221,7 +2220,6 @@ contains(DEFINES, ENABLE_DATABASE=1) {
bindings/js/JSCustomSQLStatementErrorCallback.cpp \
bindings/js/JSCustomSQLTransactionCallback.cpp \
bindings/js/JSCustomSQLTransactionErrorCallback.cpp \
bindings/js/JSDatabaseCallback.cpp \
bindings/js/JSDatabaseCustom.cpp \
bindings/js/JSSQLResultSetRowListCustom.cpp \
bindings/js/JSSQLTransactionCustom.cpp
......@@ -2232,7 +2230,6 @@ contains(DEFINES, ENABLE_DOM_STORAGE=1) {
storage/ChangeVersionWrapper.h \
storage/DatabaseAuthorizer.h \
storage/Database.h \
storage/DatabaseCallback.h \
storage/DatabaseTask.h \
storage/DatabaseThread.h \
storage/DatabaseTracker.h \
......
......@@ -35339,14 +35339,6 @@
RelativePath="..\bindings\js\JSCustomXPathNSResolver.h"
>
</File>
<File
RelativePath="..\bindings\js\JSDatabaseCallback.cpp"
>
</File>
<File
RelativePath="..\bindings\js\JSDatabaseCallback.h"
>
</File>
<File
RelativePath="..\bindings\js\JSDatabaseCustom.cpp"
>
......@@ -42284,10 +42276,6 @@
RelativePath="..\storage\DatabaseAuthorizer.h"
>
</File>
<File
RelativePath="..\storage\DatabaseCallback.h"
>
</File>
<File
RelativePath="..\storage\DatabaseTask.cpp"
>
......
......@@ -23,7 +23,6 @@
#include "AtomicString.h"
#include "Base64.h"
#include "Chrome.h"
#include "Database.h"
#include "DOMWindow.h"
#include "Document.h"
#include "ExceptionCode.h"
......@@ -37,8 +36,6 @@
#include "HTMLDocument.h"
#include "History.h"
#include "JSAudioConstructor.h"
#include "JSDatabase.h"
#include "JSDatabaseCallback.h"
#include "JSDOMWindowShell.h"
#include "JSEvent.h"
#include "JSEventListener.h"
......@@ -1020,24 +1017,6 @@ JSValue JSDOMWindow::removeEventListener(ExecState* exec, const ArgList& args)
return jsUndefined();
}
JSValue JSDOMWindow::openDatabase(ExecState* exec, const ArgList& args)
{
if (!allowsAccessFrom(exec) || (args.size() < 4))
return jsUndefined();
ExceptionCode ec = 0;
const UString& name = args.at(0).toString(exec);
const UString& version = args.at(1).toString(exec);
const UString& displayName = args.at(2).toString(exec);
unsigned long estimatedSize = args.at(3).toInt32(exec);
RefPtr<DatabaseCallback> creationCallback;
if ((args.size() >= 5) && args.at(4).isObject())
creationCallback = JSDatabaseCallback::create(asObject(args.at(4)), globalObject());
JSValue result = toJS(exec, globalObject(), WTF::getPtr(impl()->openDatabase(name, version, displayName, estimatedSize, creationCallback.release(), ec)));
setDOMException(exec, ec);
return result;
}
DOMWindow* toDOMWindow(JSValue value)
{
if (!value.isObject())
......
......@@ -55,8 +55,6 @@
#include "V8BindingDOMWindow.h"
#include "V8BindingState.h"
#include "V8CustomEventListener.h"
#include "V8Database.h"
#include "V8DatabaseCallback.h"
#include "V8GCForContextDispose.h"
#include "V8HTMLCollection.h"
#include "V8MessagePortCustom.h"
......@@ -808,30 +806,6 @@ v8::Handle<v8::Value> V8DOMWindow::clearIntervalCallback(const v8::Arguments& ar
return v8::Undefined();
}
v8::Handle<v8::Value> V8DOMWindow::openDatabaseCallback(const v8::Arguments& args)
{
INC_STATS("DOM.DOMWindow.openDatabase");
if (args.Length() < 4)
return v8::Undefined();
DOMWindow* imp = V8DOMWindow::toNative(args.Holder());
if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true))
return v8::Undefined();
ExceptionCode ec = 0;
String name = toWebCoreString(args[0]);
String version = toWebCoreString(args[1]);
String displayName = toWebCoreString(args[2]);
unsigned long estimatedSize = args[3]->IntegerValue();
RefPtr<DatabaseCallback> creationCallback;
if ((args.Length() >= 5) && args[4]->IsObject())
creationCallback = V8DatabaseCallback::create(args[4], imp->frame());
v8::Handle<v8::Value> result = toV8(imp->openDatabase(name, version, displayName, estimatedSize, creationCallback.release(), ec));
V8Proxy::setDOMException(ec);
return result;
}
bool V8DOMWindow::namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value> data)
{
ASSERT(V8ClassIndex::FromInt(data->Int32Value()) == V8ClassIndex::DOMWINDOW);
......
......@@ -4730,7 +4730,12 @@ static void performTask(void* ctx)
void Document::postTask(PassOwnPtr<Task> task)
{
callOnMainThread(performTask, new PerformTaskContext(m_weakReference, task));
if (isMainThread()) {
ScriptExecutionContextTaskTimer* timer = new ScriptExecutionContextTaskTimer(static_cast<Document*>(this), task);
timer->startOneShot(0);
} else {
callOnMainThread(performTask, new PerformTaskContext(m_weakReference, task));
}
}
Element* Document::findAnchor(const String& name)
......
......@@ -35,7 +35,6 @@
#include "Chrome.h"
#include "Console.h"
#include "Database.h"
#include "DatabaseCallback.h"
#include "DOMApplicationCache.h"
#include "DOMSelection.h"
#include "DOMTimer.h"
......@@ -1126,7 +1125,7 @@ double DOMWindow::devicePixelRatio() const
}
#if ENABLE(DATABASE)
PassRefPtr<Database> DOMWindow::openDatabase(const String& name, const String& version, const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback, ExceptionCode& ec)
PassRefPtr<Database> DOMWindow::openDatabase(const String& name, const String& version, const String& displayName, unsigned long estimatedSize, ExceptionCode& ec)
{
if (!m_frame)
return 0;
......@@ -1138,7 +1137,7 @@ PassRefPtr<Database> DOMWindow::openDatabase(const String& name, const String& v
if (!document->securityOrigin()->canAccessDatabase())
return 0;
return Database::openDatabase(document, name, version, displayName, estimatedSize, creationCallback, ec);
return Database::openDatabase(document, name, version, displayName, estimatedSize, ec);
}
#endif
......
......@@ -45,7 +45,6 @@ namespace WebCore {
class Console;
class DOMSelection;
class Database;
class DatabaseCallback;
class Document;
class Element;
class Event;
......@@ -199,7 +198,7 @@ namespace WebCore {
#if ENABLE(DATABASE)
// HTML 5 client-side database
PassRefPtr<Database> openDatabase(const String& name, const String& version, const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback, ExceptionCode&);
PassRefPtr<Database> openDatabase(const String& name, const String& version, const String& displayName, unsigned long estimatedSize, ExceptionCode&);
#endif
#if ENABLE(DOM_STORAGE)
......
......@@ -160,7 +160,7 @@ module window {
readonly attribute [EnabledAtRuntime] DOMApplicationCache applicationCache;
#endif
#if defined(ENABLE_DATABASE) && ENABLE_DATABASE
[EnabledAtRuntime, Custom] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in DatabaseCallback creationCallback)
[EnabledAtRuntime] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize)
raises(DOMException);
#endif
#if defined(ENABLE_DOM_STORAGE) && ENABLE_DOM_STORAGE
......
......@@ -132,31 +132,7 @@ static const String& databaseVersionKey()
static int guidForOriginAndName(const String& origin, const String& name);
class DatabaseCreationCallbackTask : public ScriptExecutionContext::Task {
public:
static PassOwnPtr<DatabaseCreationCallbackTask> create(PassRefPtr<Database> database)
{
return new DatabaseCreationCallbackTask(database);
}
virtual void performTask(ScriptExecutionContext*)
{
m_database->performCreationCallback();
}
private:
DatabaseCreationCallbackTask(PassRefPtr<Database> database)
: m_database(database)
{
}
RefPtr<Database> m_database;
};
PassRefPtr<Database> Database::openDatabase(ScriptExecutionContext* context, const String& name,
const String& expectedVersion, const String& displayName,
unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback,
ExceptionCode& e)
PassRefPtr<Database> Database::openDatabase(ScriptExecutionContext* context, const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize, ExceptionCode& e)
{
if (!DatabaseTracker::tracker().canEstablishDatabase(context, name, displayName, estimatedSize)) {
// FIXME: There should be an exception raised here in addition to returning a null Database object. The question has been raised with the WHATWG.
......@@ -164,7 +140,7 @@ PassRefPtr<Database> Database::openDatabase(ScriptExecutionContext* context, con
return 0;
}
RefPtr<Database> database = adoptRef(new Database(context, name, expectedVersion, displayName, estimatedSize, creationCallback));
RefPtr<Database> database = adoptRef(new Database(context, name, expectedVersion, displayName, estimatedSize));
if (!database->openAndVerifyVersion(e)) {
LOG(StorageAPI, "Failed to open and verify version (expected %s) of database %s", expectedVersion.ascii().data(), database->databaseDebugName().ascii().data());
......@@ -184,20 +160,10 @@ PassRefPtr<Database> Database::openDatabase(ScriptExecutionContext* context, con
}
#endif
// If it's a new database and a creation callback was provided, reset the expected
// version to "" and schedule the creation callback. Because of some subtle String
// implementation issues, we have to reset m_expectedVersion here instead of doing
// it inside performOpenAndVerify() which is run on the DB thread.
if (database->isNew() && database->m_creationCallback.get()) {
database->m_expectedVersion = "";
LOG(StorageAPI, "Scheduling DatabaseCreationCallbackTask for database %p\n", database.get());
database->m_scriptExecutionContext->postTask(DatabaseCreationCallbackTask::create(database));
}
return database;
}
Database::Database(ScriptExecutionContext* context, const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback)
Database::Database(ScriptExecutionContext* context, const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize)
: m_transactionInProgress(false)
, m_isTransactionQueueEnabled(true)
, m_scriptExecutionContext(context)
......@@ -209,8 +175,6 @@ Database::Database(ScriptExecutionContext* context, const String& name, const St
, m_deleted(false)
, m_stopped(false)
, m_opened(false)
, m_new(false)
, m_creationCallback(creationCallback)
{
ASSERT(m_scriptExecutionContext.get());
m_mainThreadSecurityOrigin = m_scriptExecutionContext->securityOrigin();
......@@ -556,8 +520,6 @@ bool Database::performOpenAndVerify(ExceptionCode& e)
LOG(StorageAPI, "No cached version for guid %i", m_guid);
if (!m_sqliteDatabase.tableExists(databaseInfoTableName())) {
m_new = true;
if (!m_sqliteDatabase.executeCommand("CREATE TABLE " + databaseInfoTableName() + " (key TEXT NOT NULL ON CONFLICT FAIL UNIQUE ON CONFLICT REPLACE,value TEXT NOT NULL ON CONFLICT FAIL);")) {
LOG_ERROR("Unable to create table %s in database %s", databaseInfoTableName().ascii().data(), databaseDebugName().ascii().data());
e = INVALID_STATE_ERR;
......@@ -576,7 +538,7 @@ bool Database::performOpenAndVerify(ExceptionCode& e)
}
if (currentVersion.length()) {
LOG(StorageAPI, "Retrieved current version %s from database %s", currentVersion.ascii().data(), databaseDebugName().ascii().data());
} else if (!m_new || !m_creationCallback) {
} else {
LOG(StorageAPI, "Setting version %s in database %s that was just created", m_expectedVersion.ascii().data(), databaseDebugName().ascii().data());
if (!setVersionInDatabase(m_expectedVersion)) {
LOG_ERROR("Failed to set version %s in database %s", m_expectedVersion.ascii().data(), databaseDebugName().ascii().data());
......@@ -599,7 +561,7 @@ bool Database::performOpenAndVerify(ExceptionCode& e)
// If the expected version isn't the empty string, ensure that the current database version we have matches that version. Otherwise, set an exception.
// If the expected version is the empty string, then we always return with whatever version of the database we have.
if ((!m_new || !m_creationCallback) && m_expectedVersion.length() && m_expectedVersion != currentVersion) {
if (m_expectedVersion.length() && m_expectedVersion != currentVersion) {
LOG(StorageAPI, "page expects version %s from database %s, which actually has version name %s - openDatabase() call will fail", m_expectedVersion.ascii().data(),
databaseDebugName().ascii().data(), currentVersion.ascii().data());
e = INVALID_STATE_ERR;
......@@ -723,11 +685,6 @@ Vector<String> Database::performGetTableNames()
return tableNames;
}
void Database::performCreationCallback()
{
m_creationCallback->handleEvent(m_scriptExecutionContext.get(), this);
}
SQLTransactionClient* Database::transactionClient() const
{
return m_scriptExecutionContext->databaseThread()->transactionClient();
......
......@@ -30,7 +30,6 @@
#define Database_h
#if ENABLE(DATABASE)
#include "DatabaseCallback.h"
#include "PlatformString.h"
#include "SecurityOrigin.h"
#include "SQLiteDatabase.h"
......@@ -52,7 +51,6 @@
namespace WebCore {
class DatabaseAuthorizer;
class DatabaseCallback;
class DatabaseThread;
class ScriptExecutionContext;
class SQLResultSet;
......@@ -75,10 +73,7 @@ public:
~Database();
// Direct support for the DOM API
static PassRefPtr<Database> openDatabase(ScriptExecutionContext* context, const String& name,
const String& expectedVersion, const String& displayName,
unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback,
ExceptionCode&);
static PassRefPtr<Database> openDatabase(ScriptExecutionContext* context, const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize, ExceptionCode&);
String version() const;
void changeVersion(const String& oldVersion, const String& newVersion,
PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback,
......@@ -116,8 +111,6 @@ public:
void stop();
bool stopped() const { return m_stopped; }
bool isNew() const { return m_new; }
unsigned long long databaseSize() const;
unsigned long long maximumSize() const;
......@@ -128,7 +121,6 @@ public:
bool performOpenAndVerify(ExceptionCode&);
Vector<String> performGetTableNames();
void performCreationCallback();
SQLTransactionClient* transactionClient() const;
SQLTransactionCoordinator* transactionCoordinator() const;
......@@ -136,7 +128,7 @@ public:
private:
Database(ScriptExecutionContext* context, const String& name,
const String& expectedVersion, const String& displayName,
unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback);
unsigned long estimatedSize);
bool openAndVerifyVersion(ExceptionCode&);
......@@ -167,13 +159,9 @@ private:
bool m_opened;
bool m_new;
SQLiteDatabase m_sqliteDatabase;
RefPtr<DatabaseAuthorizer> m_databaseAuthorizer;
RefPtr<DatabaseCallback> m_creationCallback;
#ifndef NDEBUG
String databaseDebugName() const { return m_mainThreadSecurityOrigin->toString() + "::" + m_name; }
#endif
......
......@@ -256,7 +256,7 @@ NotificationCenter* WorkerContext::webkitNotifications() const
#endif
#if ENABLE(DATABASE)
PassRefPtr<Database> WorkerContext::openDatabase(const String& name, const String& version, const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback, ExceptionCode& ec)
PassRefPtr<Database> WorkerContext::openDatabase(const String& name, const String& version, const String& displayName, unsigned long estimatedSize, ExceptionCode& ec)
{
if (!securityOrigin()->canAccessDatabase()) {
ec = SECURITY_ERR;
......@@ -267,7 +267,7 @@ PassRefPtr<Database> WorkerContext::openDatabase(const String& name, const Strin
if (!Database::isAvailable())
return 0;
return Database::openDatabase(this, name, version, displayName, estimatedSize, creationCallback, ec);
return Database::openDatabase(this, name, version, displayName, estimatedSize, ec);
}
#endif
......
......@@ -31,7 +31,6 @@
#include "AtomicStringHash.h"
#include "Database.h"
#include "DatabaseCallback.h"
#include "EventListener.h"
#include "EventNames.h"
#include "EventTarget.h"
......@@ -107,7 +106,7 @@ namespace WebCore {
#if ENABLE(DATABASE)
// HTML 5 client-side database
PassRefPtr<Database> openDatabase(const String& name, const String& version, const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback, ExceptionCode&);
PassRefPtr<Database> openDatabase(const String& name, const String& version, const String& displayName, unsigned long estimatedSize, ExceptionCode&);
// Not implemented yet.
virtual bool isDatabaseReadOnly() const { return false; }
// Not implemented yet.
......
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