Index: Source/bindings/v8/V8RecursionScope.cpp |
diff --git a/Source/bindings/v8/V8RecursionScope.cpp b/Source/bindings/v8/V8RecursionScope.cpp |
index c08fba7c855efb188047777c0fb263a92d5f16c7..143f754d5c98b80363865fb1069be3390ec06382 100644 |
--- a/Source/bindings/v8/V8RecursionScope.cpp |
+++ b/Source/bindings/v8/V8RecursionScope.cpp |
@@ -31,7 +31,10 @@ |
#include "config.h" |
#include "bindings/v8/V8RecursionScope.h" |
+#include "core/dom/ExecutionContext.h" |
#include "core/dom/Microtask.h" |
+#include "core/workers/WorkerGlobalScope.h" |
+#include "core/workers/WorkerThread.h" |
#include "modules/indexeddb/IDBPendingTransactionMonitor.h" |
namespace WebCore { |
@@ -44,8 +47,22 @@ void V8RecursionScope::didLeaveScriptContext() |
// set to true, but the flag becomes false when control returns to the event loop. |
IDBPendingTransactionMonitor::deactivateNewTransactions(); |
- if (m_isDocumentContext) |
+ if (!isStopped()) |
Microtask::performCheckpoint(); |
} |
+bool V8RecursionScope::isStopped() |
+{ |
+ if (!m_context || m_context->activeDOMObjectsAreStopped()) |
adamk
2014/03/28 17:55:05
How do you know a null context indicates "stopped"
|
+ return true; |
+ if (m_context->isDocument()) |
+ return false; |
+ if (m_context->isWorkerGlobalScope()) { |
+ WorkerGlobalScope* workerContext = toWorkerGlobalScope(m_context); |
+ WorkerThread* thread = workerContext->thread(); |
+ return workerContext->isClosing() || !thread || thread->runLoop().terminated(); |
+ } |
+ return true; |
+} |
+ |
} // namespace WebCore |