| Index: Source/core/dom/ExecutionContext.cpp
|
| diff --git a/Source/core/dom/ExecutionContext.cpp b/Source/core/dom/ExecutionContext.cpp
|
| index e093bd52350532b602e65f735cd565fc1b5f5858..a34b6d1cc484fe70cb1790f107189f75ed775e09 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"
|
| @@ -74,6 +75,7 @@ ExecutionContext::ExecutionContext()
|
| , m_activeDOMObjectsAreSuspended(false)
|
| , m_activeDOMObjectsAreStopped(false)
|
| , m_strictMixedContentCheckingEnforced(false)
|
| + , m_windowFocusTokens(0)
|
| {
|
| }
|
|
|
| @@ -272,6 +274,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)
|
|
|