summaryrefslogtreecommitdiffstats
path: root/WebCore/workers/WorkerRunLoop.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/workers/WorkerRunLoop.cpp')
-rw-r--r--WebCore/workers/WorkerRunLoop.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/WebCore/workers/WorkerRunLoop.cpp b/WebCore/workers/WorkerRunLoop.cpp
index cb31fe7..39b21c6 100644
--- a/WebCore/workers/WorkerRunLoop.cpp
+++ b/WebCore/workers/WorkerRunLoop.cpp
@@ -77,7 +77,7 @@ public:
private:
Task(PassRefPtr<ScriptExecutionContext::Task> task, const String& mode)
: m_task(task)
- , m_mode(mode.copy())
+ , m_mode(mode.crossThreadString())
{
}
@@ -173,6 +173,10 @@ MessageQueueWaitResult WorkerRunLoop::runInMode(WorkerContext* context, const Mo
RefPtr<Task> task;
MessageQueueWaitResult result = m_messageQueue.waitForMessageFilteredWithTimeout(task, predicate, absoluteTime);
+ // If the context is closing, don't dispatch any further tasks (per section 4.1.1 of the Web Workers spec).
+ if (context->isClosing())
+ return result;
+
switch (result) {
case MessageQueueTerminated:
break;
@@ -201,7 +205,7 @@ void WorkerRunLoop::postTask(PassRefPtr<ScriptExecutionContext::Task> task)
void WorkerRunLoop::postTaskForMode(PassRefPtr<ScriptExecutionContext::Task> task, const String& mode)
{
- m_messageQueue.append(Task::create(task, mode.copy()));
+ m_messageQueue.append(Task::create(task, mode.crossThreadString()));
}
} // namespace WebCore