Changeset 55485 in webkit
- Timestamp:
- Mar 3, 2010 4:38:00 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/Android.jscbindings.mk
r55474 r55485 81 81 bindings/js/JSCustomSQLTransactionErrorCallback.cpp \ 82 82 bindings/js/JSCustomVoidCallback.cpp \ 83 bindings/js/JSDatabaseCallback.cpp \84 83 bindings/js/JSDesktopNotificationsCustom.cpp \ 85 84 bindings/js/JSDOMApplicationCacheCustom.cpp \ -
trunk/WebCore/Android.v8bindings.mk
r55474 r55485 109 109 bindings/v8/custom/V8DOMWindowCustom.cpp \ 110 110 bindings/v8/custom/V8DataGridColumnListCustom.cpp \ 111 bindings/v8/custom/V8DatabaseCallback.cpp \112 111 bindings/v8/custom/V8DatabaseCustom.cpp \ 113 112 bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp \ -
trunk/WebCore/ChangeLog
r55484 r55485 1 2010-03-03 David Levin <levin@chromium.org> 2 3 No review, rolling out r55474. 4 http://trac.webkit.org/changeset/55480 5 6 The patch broke fast/frames/sandboxed-iframe-storage.html 7 8 * Android.jscbindings.mk: 9 * Android.v8bindings.mk: 10 * GNUmakefile.am: 11 * WebCore.gypi: 12 * WebCore.pro: 13 * WebCore.vcproj/WebCore.vcproj: 14 * bindings/js/JSDOMWindowCustom.cpp: 15 * bindings/v8/custom/V8DOMWindowCustom.cpp: 16 * dom/Document.cpp: 17 (WebCore::Document::postTask): 18 * page/DOMWindow.cpp: 19 (WebCore::DOMWindow::openDatabase): 20 * page/DOMWindow.h: 21 * page/DOMWindow.idl: 22 * storage/Database.cpp: 23 (WebCore::Database::openDatabase): 24 (WebCore::Database::Database): 25 (WebCore::Database::performOpenAndVerify): 26 * storage/Database.h: 27 * workers/WorkerContext.cpp: 28 (WebCore::WorkerContext::openDatabase): 29 * workers/WorkerContext.h: 30 1 31 2010-03-03 David Levin <levin@chromium.org> 2 32 -
trunk/WebCore/GNUmakefile.am
r55474 r55485 2229 2229 WebCore/bindings/js/JSCustomSQLTransactionErrorCallback.cpp \ 2230 2230 WebCore/bindings/js/JSCustomSQLTransactionErrorCallback.h \ 2231 WebCore/bindings/js/JSDatabaseCallback.cpp \2232 WebCore/bindings/js/JSDatabaseCallback.h \2233 2231 WebCore/bindings/js/JSDatabaseCustom.cpp \ 2234 2232 WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp \ … … 2251 2249 WebCore/storage/DatabaseAuthorizer.cpp \ 2252 2250 WebCore/storage/DatabaseAuthorizer.h \ 2253 WebCore/storage/DatabaseCallback.h \2254 2251 WebCore/storage/DatabaseDetails.h \ 2255 2252 WebCore/storage/DatabaseTask.cpp \ -
trunk/WebCore/WebCore.gypi
r55474 r55485 704 704 'bindings/v8/custom/V8CustomXPathNSResolver.cpp', 705 705 'bindings/v8/custom/V8CustomXPathNSResolver.h', 706 'bindings/v8/custom/V8DatabaseCallback.cpp',707 'bindings/v8/custom/V8DatabaseCallback.h',708 706 'bindings/v8/custom/V8DatabaseCustom.cpp', 709 707 'bindings/v8/custom/V8DataGridColumnListCustom.cpp', … … 3221 3219 'storage/DatabaseAuthorizer.cpp', 3222 3220 'storage/DatabaseAuthorizer.h', 3223 'storage/DatabaseCallback.h',3224 3221 'storage/DatabaseDetails.h', 3225 3222 'storage/DatabaseTask.cpp', -
trunk/WebCore/WebCore.pro
r55474 r55485 1013 1013 bindings/js/JSCustomVoidCallback.h \ 1014 1014 bindings/js/JSCustomXPathNSResolver.h \ 1015 bindings/js/JSDatabaseCallback.h \1016 1015 bindings/js/JSDataGridDataSource.h \ 1017 1016 bindings/js/JSDOMBinding.h \ … … 2222 2221 bindings/js/JSCustomSQLTransactionCallback.cpp \ 2223 2222 bindings/js/JSCustomSQLTransactionErrorCallback.cpp \ 2224 bindings/js/JSDatabaseCallback.cpp \2225 2223 bindings/js/JSDatabaseCustom.cpp \ 2226 2224 bindings/js/JSSQLResultSetRowListCustom.cpp \ … … 2233 2231 storage/DatabaseAuthorizer.h \ 2234 2232 storage/Database.h \ 2235 storage/DatabaseCallback.h \2236 2233 storage/DatabaseTask.h \ 2237 2234 storage/DatabaseThread.h \ -
trunk/WebCore/WebCore.vcproj/WebCore.vcproj
r55474 r55485 35341 35341 </File> 35342 35342 <File 35343 RelativePath="..\bindings\js\JSDatabaseCallback.cpp"35344 >35345 </File>35346 <File35347 RelativePath="..\bindings\js\JSDatabaseCallback.h"35348 >35349 </File>35350 <File35351 35343 RelativePath="..\bindings\js\JSDatabaseCustom.cpp" 35352 35344 > … … 42286 42278 </File> 42287 42279 <File 42288 RelativePath="..\storage\DatabaseCallback.h"42289 >42290 </File>42291 <File42292 42280 RelativePath="..\storage\DatabaseTask.cpp" 42293 42281 > -
trunk/WebCore/bindings/js/JSDOMWindowCustom.cpp
r55474 r55485 24 24 #include "Base64.h" 25 25 #include "Chrome.h" 26 #include "Database.h"27 26 #include "DOMWindow.h" 28 27 #include "Document.h" … … 38 37 #include "History.h" 39 38 #include "JSAudioConstructor.h" 40 #include "JSDatabase.h"41 #include "JSDatabaseCallback.h"42 39 #include "JSDOMWindowShell.h" 43 40 #include "JSEvent.h" … … 1021 1018 } 1022 1019 1023 JSValue JSDOMWindow::openDatabase(ExecState* exec, const ArgList& args)1024 {1025 if (!allowsAccessFrom(exec) || (args.size() < 4))1026 return jsUndefined();1027 ExceptionCode ec = 0;1028 const UString& name = args.at(0).toString(exec);1029 const UString& version = args.at(1).toString(exec);1030 const UString& displayName = args.at(2).toString(exec);1031 unsigned long estimatedSize = args.at(3).toInt32(exec);1032 RefPtr<DatabaseCallback> creationCallback;1033 if ((args.size() >= 5) && args.at(4).isObject())1034 creationCallback = JSDatabaseCallback::create(asObject(args.at(4)), globalObject());1035 1036 JSValue result = toJS(exec, globalObject(), WTF::getPtr(impl()->openDatabase(name, version, displayName, estimatedSize, creationCallback.release(), ec)));1037 setDOMException(exec, ec);1038 return result;1039 }1040 1041 1020 DOMWindow* toDOMWindow(JSValue value) 1042 1021 { -
trunk/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
r55474 r55485 56 56 #include "V8BindingState.h" 57 57 #include "V8CustomEventListener.h" 58 #include "V8Database.h"59 #include "V8DatabaseCallback.h"60 58 #include "V8GCForContextDispose.h" 61 59 #include "V8HTMLCollection.h" … … 809 807 } 810 808 811 v8::Handle<v8::Value> V8DOMWindow::openDatabaseCallback(const v8::Arguments& args)812 {813 INC_STATS("DOM.DOMWindow.openDatabase");814 if (args.Length() < 4)815 return v8::Undefined();816 817 DOMWindow* imp = V8DOMWindow::toNative(args.Holder());818 if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true))819 return v8::Undefined();820 821 ExceptionCode ec = 0;822 String name = toWebCoreString(args[0]);823 String version = toWebCoreString(args[1]);824 String displayName = toWebCoreString(args[2]);825 unsigned long estimatedSize = args[3]->IntegerValue();826 RefPtr<DatabaseCallback> creationCallback;827 if ((args.Length() >= 5) && args[4]->IsObject())828 creationCallback = V8DatabaseCallback::create(args[4], imp->frame());829 830 v8::Handle<v8::Value> result = toV8(imp->openDatabase(name, version, displayName, estimatedSize, creationCallback.release(), ec));831 V8Proxy::setDOMException(ec);832 return result;833 }834 835 809 bool V8DOMWindow::namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value> data) 836 810 { -
trunk/WebCore/dom/Document.cpp
r55474 r55485 4731 4731 void Document::postTask(PassOwnPtr<Task> task) 4732 4732 { 4733 callOnMainThread(performTask, new PerformTaskContext(m_weakReference, task)); 4733 if (isMainThread()) { 4734 ScriptExecutionContextTaskTimer* timer = new ScriptExecutionContextTaskTimer(static_cast<Document*>(this), task); 4735 timer->startOneShot(0); 4736 } else { 4737 callOnMainThread(performTask, new PerformTaskContext(m_weakReference, task)); 4738 } 4734 4739 } 4735 4740 -
trunk/WebCore/page/DOMWindow.cpp
r55474 r55485 36 36 #include "Console.h" 37 37 #include "Database.h" 38 #include "DatabaseCallback.h"39 38 #include "DOMApplicationCache.h" 40 39 #include "DOMSelection.h" … … 1127 1126 1128 1127 #if ENABLE(DATABASE) 1129 PassRefPtr<Database> DOMWindow::openDatabase(const String& name, const String& version, const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback,ExceptionCode& ec)1128 PassRefPtr<Database> DOMWindow::openDatabase(const String& name, const String& version, const String& displayName, unsigned long estimatedSize, ExceptionCode& ec) 1130 1129 { 1131 1130 if (!m_frame) … … 1139 1138 return 0; 1140 1139 1141 return Database::openDatabase(document, name, version, displayName, estimatedSize, creationCallback,ec);1140 return Database::openDatabase(document, name, version, displayName, estimatedSize, ec); 1142 1141 } 1143 1142 #endif -
trunk/WebCore/page/DOMWindow.h
r55474 r55485 46 46 class DOMSelection; 47 47 class Database; 48 class DatabaseCallback;49 48 class Document; 50 49 class Element; … … 200 199 #if ENABLE(DATABASE) 201 200 // HTML 5 client-side database 202 PassRefPtr<Database> openDatabase(const String& name, const String& version, const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback,ExceptionCode&);201 PassRefPtr<Database> openDatabase(const String& name, const String& version, const String& displayName, unsigned long estimatedSize, ExceptionCode&); 203 202 #endif 204 203 -
trunk/WebCore/page/DOMWindow.idl
r55474 r55485 161 161 #endif 162 162 #if defined(ENABLE_DATABASE) && ENABLE_DATABASE 163 [EnabledAtRuntime , Custom] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in DatabaseCallback creationCallback)163 [EnabledAtRuntime] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize) 164 164 raises(DOMException); 165 165 #endif -
trunk/WebCore/storage/Database.cpp
r55484 r55485 133 133 static int guidForOriginAndName(const String& origin, const String& name); 134 134 135 class DatabaseCreationCallbackTask : public ScriptExecutionContext::Task { 136 public: 137 static PassOwnPtr<DatabaseCreationCallbackTask> create(PassRefPtr<Database> database) 138 { 139 return new DatabaseCreationCallbackTask(database); 140 } 141 142 virtual void performTask(ScriptExecutionContext*) 143 { 144 m_database->performCreationCallback(); 145 } 146 147 private: 148 DatabaseCreationCallbackTask(PassRefPtr<Database> database) 149 : m_database(database) 150 { 151 } 152 153 RefPtr<Database> m_database; 154 }; 155 156 PassRefPtr<Database> Database::openDatabase(ScriptExecutionContext* context, const String& name, 157 const String& expectedVersion, const String& displayName, 158 unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback, 159 ExceptionCode& e) 135 PassRefPtr<Database> Database::openDatabase(ScriptExecutionContext* context, const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize, ExceptionCode& e) 160 136 { 161 137 if (!DatabaseTracker::tracker().canEstablishDatabase(context, name, displayName, estimatedSize)) { … … 165 141 } 166 142 167 RefPtr<Database> database = adoptRef(new Database(context, name, expectedVersion, displayName, estimatedSize , creationCallback));143 RefPtr<Database> database = adoptRef(new Database(context, name, expectedVersion, displayName, estimatedSize)); 168 144 169 145 if (!database->openAndVerifyVersion(e)) { … … 185 161 #endif 186 162 187 // If it's a new database and a creation callback was provided, reset the expected188 // version to "" and schedule the creation callback. Because of some subtle String189 // implementation issues, we have to reset m_expectedVersion here instead of doing190 // it inside performOpenAndVerify() which is run on the DB thread.191 if (database->isNew() && database->m_creationCallback.get()) {192 database->m_expectedVersion = "";193 LOG(StorageAPI, "Scheduling DatabaseCreationCallbackTask for database %p\n", database.get());194 database->m_scriptExecutionContext->postTask(DatabaseCreationCallbackTask::create(database));195 }196 197 163 return database; 198 164 } 199 165 200 Database::Database(ScriptExecutionContext* context, const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize , PassRefPtr<DatabaseCallback> creationCallback)166 Database::Database(ScriptExecutionContext* context, const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize) 201 167 : m_transactionInProgress(false) 202 168 , m_isTransactionQueueEnabled(true) … … 210 176 , m_stopped(false) 211 177 , m_opened(false) 212 , m_new(false)213 , m_creationCallback(creationCallback)214 178 { 215 179 ASSERT(m_scriptExecutionContext.get()); … … 557 521 558 522 if (!m_sqliteDatabase.tableExists(databaseInfoTableName())) { 559 m_new = true;560 561 523 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);")) { 562 524 LOG_ERROR("Unable to create table %s in database %s", databaseInfoTableName().ascii().data(), databaseDebugName().ascii().data()); … … 577 539 if (currentVersion.length()) { 578 540 LOG(StorageAPI, "Retrieved current version %s from database %s", currentVersion.ascii().data(), databaseDebugName().ascii().data()); 579 } else if (!m_new || !m_creationCallback){541 } else { 580 542 LOG(StorageAPI, "Setting version %s in database %s that was just created", m_expectedVersion.ascii().data(), databaseDebugName().ascii().data()); 581 543 if (!setVersionInDatabase(m_expectedVersion)) { … … 600 562 // If the expected version isn't the empty string, ensure that the current database version we have matches that version. Otherwise, set an exception. 601 563 // If the expected version is the empty string, then we always return with whatever version of the database we have. 602 if ( (!m_new || !m_creationCallback) &&m_expectedVersion.length() && m_expectedVersion != currentVersion) {564 if (m_expectedVersion.length() && m_expectedVersion != currentVersion) { 603 565 LOG(StorageAPI, "page expects version %s from database %s, which actually has version name %s - openDatabase() call will fail", m_expectedVersion.ascii().data(), 604 566 databaseDebugName().ascii().data(), currentVersion.ascii().data()); … … 724 686 } 725 687 726 void Database::performCreationCallback()727 {728 m_creationCallback->handleEvent(m_scriptExecutionContext.get(), this);729 }730 731 688 SQLTransactionClient* Database::transactionClient() const 732 689 { -
trunk/WebCore/storage/Database.h
r55484 r55485 31 31 32 32 #if ENABLE(DATABASE) 33 #include "DatabaseCallback.h"34 33 #include "PlatformString.h" 35 34 #include "SecurityOrigin.h" … … 53 52 54 53 class DatabaseAuthorizer; 55 class DatabaseCallback;56 54 class DatabaseThread; 57 55 class ScriptExecutionContext; … … 76 74 77 75 // Direct support for the DOM API 78 static PassRefPtr<Database> openDatabase(ScriptExecutionContext* context, const String& name, 79 const String& expectedVersion, const String& displayName, 80 unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback, 81 ExceptionCode&); 76 static PassRefPtr<Database> openDatabase(ScriptExecutionContext* context, const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize, ExceptionCode&); 82 77 String version() const; 83 78 void changeVersion(const String& oldVersion, const String& newVersion, … … 117 112 bool stopped() const { return m_stopped; } 118 113 119 bool isNew() const { return m_new; }120 121 114 unsigned long long databaseSize() const; 122 115 unsigned long long maximumSize() const; … … 129 122 130 123 Vector<String> performGetTableNames(); 131 void performCreationCallback();132 124 133 125 SQLTransactionClient* transactionClient() const; … … 137 129 Database(ScriptExecutionContext* context, const String& name, 138 130 const String& expectedVersion, const String& displayName, 139 unsigned long estimatedSize , PassRefPtr<DatabaseCallback> creationCallback);131 unsigned long estimatedSize); 140 132 141 133 bool openAndVerifyVersion(ExceptionCode&); … … 168 160 bool m_opened; 169 161 170 bool m_new;171 172 162 SQLiteDatabase m_sqliteDatabase; 173 163 RefPtr<DatabaseAuthorizer> m_databaseAuthorizer; 174 175 RefPtr<DatabaseCallback> m_creationCallback;176 164 177 165 #ifndef NDEBUG -
trunk/WebCore/workers/WorkerContext.cpp
r55474 r55485 257 257 258 258 #if ENABLE(DATABASE) 259 PassRefPtr<Database> WorkerContext::openDatabase(const String& name, const String& version, const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback,ExceptionCode& ec)259 PassRefPtr<Database> WorkerContext::openDatabase(const String& name, const String& version, const String& displayName, unsigned long estimatedSize, ExceptionCode& ec) 260 260 { 261 261 if (!securityOrigin()->canAccessDatabase()) { … … 268 268 return 0; 269 269 270 return Database::openDatabase(this, name, version, displayName, estimatedSize, creationCallback,ec);270 return Database::openDatabase(this, name, version, displayName, estimatedSize, ec); 271 271 } 272 272 #endif -
trunk/WebCore/workers/WorkerContext.h
r55474 r55485 32 32 #include "AtomicStringHash.h" 33 33 #include "Database.h" 34 #include "DatabaseCallback.h"35 34 #include "EventListener.h" 36 35 #include "EventNames.h" … … 108 107 #if ENABLE(DATABASE) 109 108 // HTML 5 client-side database 110 PassRefPtr<Database> openDatabase(const String& name, const String& version, const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback,ExceptionCode&);109 PassRefPtr<Database> openDatabase(const String& name, const String& version, const String& displayName, unsigned long estimatedSize, ExceptionCode&); 111 110 // Not implemented yet. 112 111 virtual bool isDatabaseReadOnly() const { return false; }
Note: See TracChangeset
for help on using the changeset viewer.