Diff
Modified: trunk/LayoutTests/ChangeLog (122462 => 122463)
--- trunk/LayoutTests/ChangeLog 2012-07-12 15:34:35 UTC (rev 122462)
+++ trunk/LayoutTests/ChangeLog 2012-07-12 15:38:14 UTC (rev 122463)
@@ -1,3 +1,20 @@
+2012-07-12 Joshua Bell <[email protected]>
+
+ IndexedDB: ASSERT hit calling open from callback in Worker
+ https://bugs.webkit.org/show_bug.cgi?id=90832
+
+ Reviewed by Kentaro Hara.
+
+ Call IDBFactory.open() twice from a worker - once from the initial worker
+ script evaluation, and once in a callback after the worker thread data
+ has been purged.
+
+ * storage/indexeddb/open-twice-workers-expected.txt: Added.
+ * storage/indexeddb/open-twice-workers.html: Added.
+ * storage/indexeddb/resources/open-twice.js: Added.
+ (test):
+ (openAnother):
+
2012-07-12 Kristóf Kosztyó <[email protected]>
[Qt] platform/qt/css3 tests needs update after rebaseline
Added: trunk/LayoutTests/storage/indexeddb/open-twice-workers-expected.txt (0 => 122463)
--- trunk/LayoutTests/storage/indexeddb/open-twice-workers-expected.txt (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/open-twice-workers-expected.txt 2012-07-12 15:38:14 UTC (rev 122463)
@@ -0,0 +1,14 @@
+[Worker] Test opening twice
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Starting worker: resources/open-twice.js
+[Worker] indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+[Worker]
+[Worker] indexedDB.open('open-twice1')
+[Worker] indexedDB.open('open-twice2')
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/storage/indexeddb/open-twice-workers.html (0 => 122463)
--- trunk/LayoutTests/storage/indexeddb/open-twice-workers.html (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/open-twice-workers.html 2012-07-12 15:38:14 UTC (rev 122463)
@@ -0,0 +1,10 @@
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+<script>startWorker('resources/open-twice.js');</script>
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/storage/indexeddb/resources/open-twice.js (0 => 122463)
--- trunk/LayoutTests/storage/indexeddb/resources/open-twice.js (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/resources/open-twice.js 2012-07-12 15:38:14 UTC (rev 122463)
@@ -0,0 +1,26 @@
+if (this.importScripts) {
+ importScripts('../../../fast/js/resources/js-test-pre.js');
+ importScripts('shared.js');
+}
+
+description("Test opening twice");
+
+function test()
+{
+ removeVendorPrefixes();
+
+ request = evalAndLog("indexedDB.open('open-twice1')");
+ request._onerror_ = unexpectedErrorCallback;
+ request._onblocked_ = unexpectedBlockedCallback;
+ request._onsuccess_ = openAnother;
+};
+
+function openAnother()
+{
+ request = evalAndLog("indexedDB.open('open-twice2')");
+ request._onerror_ = unexpectedErrorCallback;
+ request._onblocked_ = unexpectedBlockedCallback;
+ request._onsuccess_ = finishJSTest;
+}
+
+test();
Modified: trunk/Source/WebCore/ChangeLog (122462 => 122463)
--- trunk/Source/WebCore/ChangeLog 2012-07-12 15:34:35 UTC (rev 122462)
+++ trunk/Source/WebCore/ChangeLog 2012-07-12 15:38:14 UTC (rev 122463)
@@ -1,3 +1,49 @@
+2012-07-12 Joshua Bell <[email protected]>
+
+ IndexedDB: ASSERT hit calling open from callback in Worker
+ https://bugs.webkit.org/show_bug.cgi?id=90832
+
+ Reviewed by Kentaro Hara.
+
+ GroupSettings are used to provide the backing store path in some
+ ports. Accessing those settings from a Worker was added, but the
+ access referenced thread startup data that is cleared before the
+ run loop, so an IDBFactory.open() call executed asynchronously
+ would dereference a null pointer. Plumb the settings startup
+ data into the context itself, like all of the other properties.
+
+ Test: storage/indexeddb/open-twice-workers.html
+
+ * Modules/indexeddb/IDBFactory.cpp:
+ (WebCore::IDBFactory::open):
+ * workers/DedicatedWorkerContext.cpp:
+ (WebCore::DedicatedWorkerContext::DedicatedWorkerContext):
+ * workers/DedicatedWorkerContext.h:
+ (WebCore::DedicatedWorkerContext::create):
+ (DedicatedWorkerContext):
+ * workers/DedicatedWorkerThread.cpp:
+ (WebCore::DedicatedWorkerThread::createWorkerContext):
+ * workers/DedicatedWorkerThread.h:
+ (DedicatedWorkerThread):
+ * workers/SharedWorkerContext.cpp:
+ (WebCore::SharedWorkerContext::SharedWorkerContext):
+ * workers/SharedWorkerContext.h:
+ (WebCore::SharedWorkerContext::create):
+ (SharedWorkerContext):
+ * workers/SharedWorkerThread.cpp:
+ (WebCore::SharedWorkerThread::createWorkerContext):
+ * workers/SharedWorkerThread.h:
+ (SharedWorkerThread):
+ * workers/WorkerContext.cpp:
+ (WebCore::WorkerContext::WorkerContext):
+ * workers/WorkerContext.h:
+ (WebCore::WorkerContext::groupSettings):
+ (WorkerContext):
+ * workers/WorkerThread.cpp:
+ (WebCore::WorkerThread::workerThread):
+ * workers/WorkerThread.h:
+ (WorkerThread):
+
2012-07-12 Allan Sandfeld Jensen <[email protected]>
[Qt] Implement MemoryUsageSupport
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp (122462 => 122463)
--- trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp 2012-07-12 15:34:35 UTC (rev 122462)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp 2012-07-12 15:38:14 UTC (rev 122463)
@@ -100,7 +100,7 @@
#if ENABLE(WORKERS)
RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), 0);
WorkerContext* workerContext = static_cast<WorkerContext*>(context);
- GroupSettings* groupSettings = workerContext->thread()->groupSettings();
+ const GroupSettings* groupSettings = workerContext->groupSettings();
m_backend->openFromWorker(name, request.get(), context->securityOrigin(), workerContext, groupSettings ? groupSettings->indexedDBDatabasePath() : String());
return request;
#else
Modified: trunk/Source/WebCore/workers/DedicatedWorkerContext.cpp (122462 => 122463)
--- trunk/Source/WebCore/workers/DedicatedWorkerContext.cpp 2012-07-12 15:34:35 UTC (rev 122462)
+++ trunk/Source/WebCore/workers/DedicatedWorkerContext.cpp 2012-07-12 15:38:14 UTC (rev 122463)
@@ -41,8 +41,8 @@
namespace WebCore {
-DedicatedWorkerContext::DedicatedWorkerContext(const KURL& url, const String& userAgent, DedicatedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
- : WorkerContext(url, userAgent, thread, contentSecurityPolicy, contentSecurityPolicyType)
+DedicatedWorkerContext::DedicatedWorkerContext(const KURL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, DedicatedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
+ : WorkerContext(url, userAgent, settings, thread, contentSecurityPolicy, contentSecurityPolicyType)
{
}
Modified: trunk/Source/WebCore/workers/DedicatedWorkerContext.h (122462 => 122463)
--- trunk/Source/WebCore/workers/DedicatedWorkerContext.h 2012-07-12 15:34:35 UTC (rev 122462)
+++ trunk/Source/WebCore/workers/DedicatedWorkerContext.h 2012-07-12 15:38:14 UTC (rev 122463)
@@ -44,9 +44,9 @@
class DedicatedWorkerContext : public WorkerContext {
public:
typedef WorkerContext Base;
- static PassRefPtr<DedicatedWorkerContext> create(const KURL& url, const String& userAgent, DedicatedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
+ static PassRefPtr<DedicatedWorkerContext> create(const KURL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, DedicatedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
{
- return adoptRef(new DedicatedWorkerContext(url, userAgent, thread, contentSecurityPolicy, contentSecurityPolicyType));
+ return adoptRef(new DedicatedWorkerContext(url, userAgent, settings, thread, contentSecurityPolicy, contentSecurityPolicyType));
}
virtual bool isDedicatedWorkerContext() const { return true; }
@@ -66,7 +66,7 @@
DedicatedWorkerThread* thread();
private:
- DedicatedWorkerContext(const KURL&, const String& userAgent, DedicatedWorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
+ DedicatedWorkerContext(const KURL&, const String& userAgent, PassOwnPtr<GroupSettings>, DedicatedWorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
};
} // namespace WebCore
Modified: trunk/Source/WebCore/workers/DedicatedWorkerThread.cpp (122462 => 122463)
--- trunk/Source/WebCore/workers/DedicatedWorkerThread.cpp 2012-07-12 15:34:35 UTC (rev 122462)
+++ trunk/Source/WebCore/workers/DedicatedWorkerThread.cpp 2012-07-12 15:38:14 UTC (rev 122463)
@@ -54,9 +54,9 @@
{
}
-PassRefPtr<WorkerContext> DedicatedWorkerThread::createWorkerContext(const KURL& url, const String& userAgent, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
+PassRefPtr<WorkerContext> DedicatedWorkerThread::createWorkerContext(const KURL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
{
- return DedicatedWorkerContext::create(url, userAgent, this, contentSecurityPolicy, contentSecurityPolicyType);
+ return DedicatedWorkerContext::create(url, userAgent, settings, this, contentSecurityPolicy, contentSecurityPolicyType);
}
void DedicatedWorkerThread::runEventLoop()
Modified: trunk/Source/WebCore/workers/DedicatedWorkerThread.h (122462 => 122463)
--- trunk/Source/WebCore/workers/DedicatedWorkerThread.h 2012-07-12 15:34:35 UTC (rev 122462)
+++ trunk/Source/WebCore/workers/DedicatedWorkerThread.h 2012-07-12 15:38:14 UTC (rev 122463)
@@ -46,7 +46,7 @@
~DedicatedWorkerThread();
protected:
- virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL&, const String& userAgent, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
+ virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL&, const String& userAgent, PassOwnPtr<GroupSettings>, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
virtual void runEventLoop();
private:
Modified: trunk/Source/WebCore/workers/SharedWorkerContext.cpp (122462 => 122463)
--- trunk/Source/WebCore/workers/SharedWorkerContext.cpp 2012-07-12 15:34:35 UTC (rev 122462)
+++ trunk/Source/WebCore/workers/SharedWorkerContext.cpp 2012-07-12 15:38:14 UTC (rev 122463)
@@ -50,8 +50,8 @@
return event.release();
}
-SharedWorkerContext::SharedWorkerContext(const String& name, const KURL& url, const String& userAgent, SharedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
- : WorkerContext(url, userAgent, thread, contentSecurityPolicy, contentSecurityPolicyType)
+SharedWorkerContext::SharedWorkerContext(const String& name, const KURL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, SharedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
+ : WorkerContext(url, userAgent, settings, thread, contentSecurityPolicy, contentSecurityPolicyType)
, m_name(name)
{
}
Modified: trunk/Source/WebCore/workers/SharedWorkerContext.h (122462 => 122463)
--- trunk/Source/WebCore/workers/SharedWorkerContext.h 2012-07-12 15:34:35 UTC (rev 122462)
+++ trunk/Source/WebCore/workers/SharedWorkerContext.h 2012-07-12 15:38:14 UTC (rev 122463)
@@ -44,9 +44,9 @@
class SharedWorkerContext : public WorkerContext {
public:
typedef WorkerContext Base;
- static PassRefPtr<SharedWorkerContext> create(const String& name, const KURL& url, const String& userAgent, SharedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
+ static PassRefPtr<SharedWorkerContext> create(const String& name, const KURL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, SharedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
{
- return adoptRef(new SharedWorkerContext(name, url, userAgent, thread, contentSecurityPolicy, contentSecurityPolicyType));
+ return adoptRef(new SharedWorkerContext(name, url, userAgent, settings, thread, contentSecurityPolicy, contentSecurityPolicyType));
}
virtual ~SharedWorkerContext();
@@ -61,7 +61,7 @@
SharedWorkerThread* thread();
private:
- SharedWorkerContext(const String& name, const KURL&, const String&, SharedWorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
+ SharedWorkerContext(const String& name, const KURL&, const String& userAgent, PassOwnPtr<GroupSettings>, SharedWorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
virtual void logExceptionToConsole(const String& errorMessage, const String& sourceURL, int lineNumber, PassRefPtr<ScriptCallStack>);
Modified: trunk/Source/WebCore/workers/SharedWorkerThread.cpp (122462 => 122463)
--- trunk/Source/WebCore/workers/SharedWorkerThread.cpp 2012-07-12 15:34:35 UTC (rev 122462)
+++ trunk/Source/WebCore/workers/SharedWorkerThread.cpp 2012-07-12 15:38:14 UTC (rev 122463)
@@ -53,9 +53,9 @@
{
}
-PassRefPtr<WorkerContext> SharedWorkerThread::createWorkerContext(const KURL& url, const String& userAgent, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
+PassRefPtr<WorkerContext> SharedWorkerThread::createWorkerContext(const KURL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
{
- return SharedWorkerContext::create(m_name, url, userAgent, this, contentSecurityPolicy, contentSecurityPolicyType);
+ return SharedWorkerContext::create(m_name, url, userAgent, settings, this, contentSecurityPolicy, contentSecurityPolicyType);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/workers/SharedWorkerThread.h (122462 => 122463)
--- trunk/Source/WebCore/workers/SharedWorkerThread.h 2012-07-12 15:34:35 UTC (rev 122462)
+++ trunk/Source/WebCore/workers/SharedWorkerThread.h 2012-07-12 15:38:14 UTC (rev 122463)
@@ -43,7 +43,7 @@
~SharedWorkerThread();
protected:
- virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL&, const String&, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
+ virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL&, const String& userAgent, PassOwnPtr<GroupSettings>, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
private:
SharedWorkerThread(const String& name, const KURL&, const String& userAgent, const GroupSettings*, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
Modified: trunk/Source/WebCore/workers/WorkerContext.cpp (122462 => 122463)
--- trunk/Source/WebCore/workers/WorkerContext.cpp 2012-07-12 15:34:35 UTC (rev 122462)
+++ trunk/Source/WebCore/workers/WorkerContext.cpp 2012-07-12 15:38:14 UTC (rev 122463)
@@ -85,9 +85,10 @@
virtual bool isCleanupTask() const { return true; }
};
-WorkerContext::WorkerContext(const KURL& url, const String& userAgent, WorkerThread* thread, const String& policy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
+WorkerContext::WorkerContext(const KURL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, WorkerThread* thread, const String& policy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
: m_url(url)
, m_userAgent(userAgent)
+ , m_groupSettings(settings)
, m_script(adoptPtr(new WorkerScriptController(this)))
, m_thread(thread)
#if ENABLE(INSPECTOR)
Modified: trunk/Source/WebCore/workers/WorkerContext.h (122462 => 122463)
--- trunk/Source/WebCore/workers/WorkerContext.h 2012-07-12 15:34:35 UTC (rev 122462)
+++ trunk/Source/WebCore/workers/WorkerContext.h 2012-07-12 15:38:14 UTC (rev 122463)
@@ -33,6 +33,7 @@
#include "EventListener.h"
#include "EventNames.h"
#include "EventTarget.h"
+#include "GroupSettings.h"
#include "ScriptExecutionContext.h"
#include "WorkerEventQueue.h"
#include "WorkerScriptController.h"
@@ -68,6 +69,7 @@
const KURL& url() const { return m_url; }
KURL completeURL(const String&) const;
+ const GroupSettings* groupSettings() { return m_groupSettings.get(); }
virtual String userAgent(const KURL&) const;
virtual void disableEval();
@@ -137,7 +139,7 @@
void notifyObserversOfStop();
protected:
- WorkerContext(const KURL&, const String&, WorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
+ WorkerContext(const KURL&, const String& userAgent, PassOwnPtr<GroupSettings>, WorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
virtual void logExceptionToConsole(const String& errorMessage, const String& sourceURL, int lineNumber, PassRefPtr<ScriptCallStack>);
void addMessageToWorkerConsole(MessageSource, MessageType, MessageLevel, const String& message, const String& sourceURL, unsigned lineNumber, PassRefPtr<ScriptCallStack>);
@@ -160,6 +162,7 @@
KURL m_url;
String m_userAgent;
+ OwnPtr<GroupSettings> m_groupSettings;
mutable RefPtr<WorkerLocation> m_location;
mutable RefPtr<WorkerNavigator> m_navigator;
Modified: trunk/Source/WebCore/workers/WorkerThread.cpp (122462 => 122463)
--- trunk/Source/WebCore/workers/WorkerThread.cpp 2012-07-12 15:34:35 UTC (rev 122462)
+++ trunk/Source/WebCore/workers/WorkerThread.cpp 2012-07-12 15:38:14 UTC (rev 122463)
@@ -146,7 +146,7 @@
{
{
MutexLocker lock(m_threadCreationMutex);
- m_workerContext = createWorkerContext(m_startupData->m_scriptURL, m_startupData->m_userAgent, m_startupData->m_contentSecurityPolicy, m_startupData->m_contentSecurityPolicyType);
+ m_workerContext = createWorkerContext(m_startupData->m_scriptURL, m_startupData->m_userAgent, m_startupData->m_groupSettings.release(), m_startupData->m_contentSecurityPolicy, m_startupData->m_contentSecurityPolicyType);
if (m_runLoop.terminated()) {
// The worker was terminated before the thread had a chance to run. Since the context didn't exist yet,
@@ -193,11 +193,6 @@
m_runLoop.run(m_workerContext.get());
}
-GroupSettings* WorkerThread::groupSettings()
-{
- return m_startupData->m_groupSettings.get();
-}
-
class WorkerThreadShutdownFinishTask : public ScriptExecutionContext::Task {
public:
static PassOwnPtr<WorkerThreadShutdownFinishTask> create()
Modified: trunk/Source/WebCore/workers/WorkerThread.h (122462 => 122463)
--- trunk/Source/WebCore/workers/WorkerThread.h 2012-07-12 15:34:35 UTC (rev 122462)
+++ trunk/Source/WebCore/workers/WorkerThread.h 2012-07-12 15:38:14 UTC (rev 122463)
@@ -62,7 +62,6 @@
// Number of active worker threads.
static unsigned workerThreadCount();
- GroupSettings* groupSettings();
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
NotificationClient* getNotificationClient() { return m_notificationClient; }
@@ -73,7 +72,7 @@
WorkerThread(const KURL&, const String& userAgent, const GroupSettings*, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType);
// Factory method for creating a new worker context for the thread.
- virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL&, const String& userAgent, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType) = 0;
+ virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL&, const String& userAgent, PassOwnPtr<GroupSettings>, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType) = 0;
// Executes the event loop for the worker thread. Derived classes can override to perform actions before/after entering the event loop.
virtual void runEventLoop();