| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2012 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2012 Google Inc. All Rights Reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "core/dom/ExecutionContext.h" | 29 #include "core/dom/ExecutionContext.h" |
| 30 | 30 |
| 31 #include "core/dom/AddConsoleMessageTask.h" | 31 #include "core/dom/AddConsoleMessageTask.h" |
| 32 #include "core/dom/ContextLifecycleNotifier.h" | 32 #include "core/dom/ContextLifecycleNotifier.h" |
| 33 #include "core/dom/ExecutionContextTask.h" | 33 #include "core/dom/ExecutionContextTask.h" |
| 34 #include "core/events/ErrorEvent.h" | 34 #include "core/events/ErrorEvent.h" |
| 35 #include "core/events/EventTarget.h" | 35 #include "core/events/EventTarget.h" |
| 36 #include "core/html/PublicURLManager.h" | 36 #include "core/html/PublicURLManager.h" |
| 37 #include "core/inspector/InspectorInstrumentation.h" | 37 #include "core/inspector/InspectorInstrumentation.h" |
| 38 #include "core/inspector/ScriptCallStack.h" | 38 #include "core/inspector/ScriptCallStack.h" |
| 39 #include "core/page/WindowFocusAllowedIndicator.h" | |
| 40 #include "core/workers/WorkerGlobalScope.h" | 39 #include "core/workers/WorkerGlobalScope.h" |
| 41 #include "core/workers/WorkerThread.h" | 40 #include "core/workers/WorkerThread.h" |
| 42 #include "wtf/MainThread.h" | 41 #include "wtf/MainThread.h" |
| 43 | 42 |
| 44 namespace blink { | 43 namespace blink { |
| 45 | 44 |
| 46 class ExecutionContext::PendingException : public NoBaseWillBeGarbageCollectedFi
nalized<ExecutionContext::PendingException> { | 45 class ExecutionContext::PendingException : public NoBaseWillBeGarbageCollectedFi
nalized<ExecutionContext::PendingException> { |
| 47 WTF_MAKE_NONCOPYABLE(PendingException); | 46 WTF_MAKE_NONCOPYABLE(PendingException); |
| 48 public: | 47 public: |
| 49 PendingException(const String& errorMessage, int lineNumber, int columnNumbe
r, int scriptId, const String& sourceURL, PassRefPtrWillBeRawPtr<ScriptCallStack
> callStack) | 48 PendingException(const String& errorMessage, int lineNumber, int columnNumbe
r, int scriptId, const String& sourceURL, PassRefPtrWillBeRawPtr<ScriptCallStack
> callStack) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 67 RefPtrWillBeMember<ScriptCallStack> m_callStack; | 66 RefPtrWillBeMember<ScriptCallStack> m_callStack; |
| 68 }; | 67 }; |
| 69 | 68 |
| 70 ExecutionContext::ExecutionContext() | 69 ExecutionContext::ExecutionContext() |
| 71 : m_sandboxFlags(SandboxNone) | 70 : m_sandboxFlags(SandboxNone) |
| 72 , m_circularSequentialID(0) | 71 , m_circularSequentialID(0) |
| 73 , m_timerNestingLevel(0) | 72 , m_timerNestingLevel(0) |
| 74 , m_inDispatchErrorEvent(false) | 73 , m_inDispatchErrorEvent(false) |
| 75 , m_activeDOMObjectsAreSuspended(false) | 74 , m_activeDOMObjectsAreSuspended(false) |
| 76 , m_activeDOMObjectsAreStopped(false) | 75 , m_activeDOMObjectsAreStopped(false) |
| 77 , m_windowFocusTokens(0) | |
| 78 { | 76 { |
| 79 } | 77 } |
| 80 | 78 |
| 81 ExecutionContext::~ExecutionContext() | 79 ExecutionContext::~ExecutionContext() |
| 82 { | 80 { |
| 83 } | 81 } |
| 84 | 82 |
| 85 bool ExecutionContext::hasPendingActivity() | 83 bool ExecutionContext::hasPendingActivity() |
| 86 { | 84 { |
| 87 return lifecycleNotifier().hasPendingActivity(); | 85 return lifecycleNotifier().hasPendingActivity(); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 { | 264 { |
| 267 m_sandboxFlags |= mask; | 265 m_sandboxFlags |= mask; |
| 268 | 266 |
| 269 // The SandboxOrigin is stored redundantly in the security origin. | 267 // The SandboxOrigin is stored redundantly in the security origin. |
| 270 if (isSandboxed(SandboxOrigin) && securityContext().securityOrigin() && !sec
urityContext().securityOrigin()->isUnique()) { | 268 if (isSandboxed(SandboxOrigin) && securityContext().securityOrigin() && !sec
urityContext().securityOrigin()->isUnique()) { |
| 271 securityContext().setSecurityOrigin(SecurityOrigin::createUnique()); | 269 securityContext().setSecurityOrigin(SecurityOrigin::createUnique()); |
| 272 didUpdateSecurityOrigin(); | 270 didUpdateSecurityOrigin(); |
| 273 } | 271 } |
| 274 } | 272 } |
| 275 | 273 |
| 276 void ExecutionContext::allowWindowFocus() | |
| 277 { | |
| 278 ++m_windowFocusTokens; | |
| 279 } | |
| 280 | |
| 281 void ExecutionContext::consumeWindowFocus() | |
| 282 { | |
| 283 if (m_windowFocusTokens == 0) | |
| 284 return; | |
| 285 --m_windowFocusTokens; | |
| 286 } | |
| 287 | |
| 288 bool ExecutionContext::isWindowFocusAllowed() const | |
| 289 { | |
| 290 // FIXME: WindowFocusAllowedIndicator::windowFocusAllowed() is temporary, | |
| 291 // it will be removed as soon as WebScopedWindowFocusAllowedIndicator will | |
| 292 // be updated to not use WindowFocusAllowedIndicator. | |
| 293 return m_windowFocusTokens > 0 || WindowFocusAllowedIndicator::windowFocusAl
lowed(); | |
| 294 } | |
| 295 | |
| 296 void ExecutionContext::trace(Visitor* visitor) | 274 void ExecutionContext::trace(Visitor* visitor) |
| 297 { | 275 { |
| 298 #if ENABLE(OILPAN) | 276 #if ENABLE(OILPAN) |
| 299 visitor->trace(m_pendingExceptions); | 277 visitor->trace(m_pendingExceptions); |
| 300 visitor->trace(m_publicURLManager); | 278 visitor->trace(m_publicURLManager); |
| 301 visitor->trace(m_timeouts); | 279 visitor->trace(m_timeouts); |
| 302 HeapSupplementable<ExecutionContext>::trace(visitor); | 280 HeapSupplementable<ExecutionContext>::trace(visitor); |
| 303 #endif | 281 #endif |
| 304 LifecycleContext<ExecutionContext>::trace(visitor); | 282 LifecycleContext<ExecutionContext>::trace(visitor); |
| 305 } | 283 } |
| 306 | 284 |
| 307 } // namespace blink | 285 } // namespace blink |
| OLD | NEW |