| Index: Source/core/dom/ExecutionContext.cpp
|
| diff --git a/Source/core/dom/ExecutionContext.cpp b/Source/core/dom/ExecutionContext.cpp
|
| index 887f2e70ee4a597c20c5fe8596055cf0084bb9fb..240a99d3fe3675b87db24d68d3a251f68b9a4435 100644
|
| --- a/Source/core/dom/ExecutionContext.cpp
|
| +++ b/Source/core/dom/ExecutionContext.cpp
|
| @@ -36,6 +36,7 @@
|
| #include "core/html/PublicURLManager.h"
|
| #include "core/inspector/InspectorInstrumentation.h"
|
| #include "core/inspector/ScriptCallStack.h"
|
| +#include "core/page/WindowFocusAllowedIndicator.h"
|
| #include "core/workers/WorkerGlobalScope.h"
|
| #include "core/workers/WorkerThread.h"
|
| #include "wtf/MainThread.h"
|
| @@ -73,6 +74,7 @@ ExecutionContext::ExecutionContext()
|
| , m_inDispatchErrorEvent(false)
|
| , m_activeDOMObjectsAreSuspended(false)
|
| , m_activeDOMObjectsAreStopped(false)
|
| + , m_windowFocusTokens(0)
|
| {
|
| }
|
|
|
| @@ -271,6 +273,26 @@ void ExecutionContext::enforceSandboxFlags(SandboxFlags mask)
|
| }
|
| }
|
|
|
| +void ExecutionContext::allowWindowFocus()
|
| +{
|
| + ++m_windowFocusTokens;
|
| +}
|
| +
|
| +void ExecutionContext::consumeWindowFocus()
|
| +{
|
| + if (m_windowFocusTokens == 0)
|
| + return;
|
| + --m_windowFocusTokens;
|
| +}
|
| +
|
| +bool ExecutionContext::isWindowFocusAllowed() const
|
| +{
|
| + // FIXME: WindowFocusAllowedIndicator::windowFocusAllowed() is temporary,
|
| + // it will be removed as soon as WebScopedWindowFocusAllowedIndicator will
|
| + // be updated to not use WindowFocusAllowedIndicator.
|
| + return m_windowFocusTokens > 0 || WindowFocusAllowedIndicator::windowFocusAllowed();
|
| +}
|
| +
|
| void ExecutionContext::trace(Visitor* visitor)
|
| {
|
| #if ENABLE(OILPAN)
|
|
|