| 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 11 matching lines...) Expand all Loading... |
| 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 * | 25 * |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #ifndef ExecutionContext_h | 28 #ifndef ExecutionContext_h |
| 29 #define ExecutionContext_h | 29 #define ExecutionContext_h |
| 30 | 30 |
| 31 #include "core/dom/ActiveDOMObject.h" | 31 #include "core/dom/ActiveDOMObject.h" |
| 32 #include "core/dom/SandboxFlags.h" | |
| 33 #include "core/dom/SecurityContext.h" | 32 #include "core/dom/SecurityContext.h" |
| 34 #include "core/fetch/CrossOriginAccessControl.h" | 33 #include "core/fetch/CrossOriginAccessControl.h" |
| 35 #include "core/frame/ConsoleTypes.h" | 34 #include "core/frame/ConsoleTypes.h" |
| 36 #include "core/frame/DOMTimer.h" | 35 #include "core/frame/DOMTimer.h" |
| 37 #include "core/inspector/ConsoleMessage.h" | 36 #include "core/inspector/ConsoleMessage.h" |
| 38 #include "platform/LifecycleContext.h" | 37 #include "platform/LifecycleContext.h" |
| 39 #include "platform/Supplementable.h" | 38 #include "platform/Supplementable.h" |
| 40 #include "platform/heap/Handle.h" | 39 #include "platform/heap/Handle.h" |
| 41 #include "platform/weborigin/KURL.h" | 40 #include "platform/weborigin/KURL.h" |
| 42 #include "wtf/Functional.h" | 41 #include "wtf/Functional.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 61 virtual void trace(Visitor*) override; | 60 virtual void trace(Visitor*) override; |
| 62 | 61 |
| 63 virtual bool isDocument() const { return false; } | 62 virtual bool isDocument() const { return false; } |
| 64 virtual bool isWorkerGlobalScope() const { return false; } | 63 virtual bool isWorkerGlobalScope() const { return false; } |
| 65 virtual bool isDedicatedWorkerGlobalScope() const { return false; } | 64 virtual bool isDedicatedWorkerGlobalScope() const { return false; } |
| 66 virtual bool isSharedWorkerGlobalScope() const { return false; } | 65 virtual bool isSharedWorkerGlobalScope() const { return false; } |
| 67 virtual bool isServiceWorkerGlobalScope() const { return false; } | 66 virtual bool isServiceWorkerGlobalScope() const { return false; } |
| 68 virtual bool isJSExecutionForbidden() const { return false; } | 67 virtual bool isJSExecutionForbidden() const { return false; } |
| 69 SecurityOrigin* securityOrigin(); | 68 SecurityOrigin* securityOrigin(); |
| 70 ContentSecurityPolicy* contentSecurityPolicy(); | 69 ContentSecurityPolicy* contentSecurityPolicy(); |
| 71 virtual void didUpdateSecurityOrigin() = 0; | |
| 72 const KURL& url() const; | 70 const KURL& url() const; |
| 73 KURL completeURL(const String& url) const; | 71 KURL completeURL(const String& url) const; |
| 74 virtual void disableEval(const String& errorMessage) = 0; | 72 virtual void disableEval(const String& errorMessage) = 0; |
| 75 virtual LocalDOMWindow* executingWindow() { return 0; } | 73 virtual LocalDOMWindow* executingWindow() { return 0; } |
| 76 virtual String userAgent(const KURL&) const = 0; | 74 virtual String userAgent(const KURL&) const = 0; |
| 77 virtual void postTask(PassOwnPtr<ExecutionContextTask>) = 0; // Executes the
task on context's thread asynchronously. | 75 virtual void postTask(PassOwnPtr<ExecutionContextTask>) = 0; // Executes the
task on context's thread asynchronously. |
| 78 virtual double timerAlignmentInterval() const = 0; | 76 virtual double timerAlignmentInterval() const = 0; |
| 79 | 77 |
| 80 virtual void reportBlockedScriptExecutionToInspector(const String& directive
Text) = 0; | 78 virtual void reportBlockedScriptExecutionToInspector(const String& directive
Text) = 0; |
| 81 | 79 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 #endif | 115 #endif |
| 118 | 116 |
| 119 // Gets the next id in a circular sequence from 1 to 2^31-1. | 117 // Gets the next id in a circular sequence from 1 to 2^31-1. |
| 120 int circularSequentialID(); | 118 int circularSequentialID(); |
| 121 | 119 |
| 122 void didChangeTimerAlignmentInterval(); | 120 void didChangeTimerAlignmentInterval(); |
| 123 | 121 |
| 124 int timerNestingLevel() { return m_timerNestingLevel; } | 122 int timerNestingLevel() { return m_timerNestingLevel; } |
| 125 void setTimerNestingLevel(int level) { m_timerNestingLevel = level; } | 123 void setTimerNestingLevel(int level) { m_timerNestingLevel = level; } |
| 126 | 124 |
| 127 SandboxFlags sandboxFlags() const { return m_sandboxFlags; } | |
| 128 bool isSandboxed(SandboxFlags mask) const { return m_sandboxFlags & mask; } | |
| 129 void enforceSandboxFlags(SandboxFlags mask); | |
| 130 | |
| 131 PassOwnPtr<LifecycleNotifier<ExecutionContext> > createLifecycleNotifier(); | 125 PassOwnPtr<LifecycleNotifier<ExecutionContext> > createLifecycleNotifier(); |
| 132 | 126 |
| 133 virtual EventTarget* errorEventTarget() = 0; | 127 virtual EventTarget* errorEventTarget() = 0; |
| 134 virtual EventQueue* eventQueue() const = 0; | 128 virtual EventQueue* eventQueue() const = 0; |
| 135 | 129 |
| 136 void enforceStrictMixedContentChecking() { m_strictMixedContentCheckingEnfor
ced = true; } | 130 void enforceStrictMixedContentChecking() { m_strictMixedContentCheckingEnfor
ced = true; } |
| 137 bool shouldEnforceStrictMixedContentChecking() const { return m_strictMixedC
ontentCheckingEnforced; } | 131 bool shouldEnforceStrictMixedContentChecking() const { return m_strictMixedC
ontentCheckingEnforced; } |
| 138 | 132 |
| 139 void allowWindowFocus(); | 133 void allowWindowFocus(); |
| 140 void consumeWindowFocus(); | 134 void consumeWindowFocus(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 157 #if !ENABLE(OILPAN) | 151 #if !ENABLE(OILPAN) |
| 158 virtual void refExecutionContext() = 0; | 152 virtual void refExecutionContext() = 0; |
| 159 virtual void derefExecutionContext() = 0; | 153 virtual void derefExecutionContext() = 0; |
| 160 #endif | 154 #endif |
| 161 // LifecycleContext implementation. | 155 // LifecycleContext implementation. |
| 162 | 156 |
| 163 // Implementation details for DOMTimer. No other classes should call these f
unctions. | 157 // Implementation details for DOMTimer. No other classes should call these f
unctions. |
| 164 int installNewTimeout(PassOwnPtr<ScheduledAction>, int timeout, bool singleS
hot); | 158 int installNewTimeout(PassOwnPtr<ScheduledAction>, int timeout, bool singleS
hot); |
| 165 void removeTimeoutByID(int timeoutID); // This makes underlying DOMTimer ins
tance destructed. | 159 void removeTimeoutByID(int timeoutID); // This makes underlying DOMTimer ins
tance destructed. |
| 166 | 160 |
| 167 SandboxFlags m_sandboxFlags; | |
| 168 | |
| 169 int m_circularSequentialID; | 161 int m_circularSequentialID; |
| 170 typedef WillBeHeapHashMap<int, RefPtrWillBeMember<DOMTimer> > TimeoutMap; | 162 typedef WillBeHeapHashMap<int, RefPtrWillBeMember<DOMTimer> > TimeoutMap; |
| 171 TimeoutMap m_timeouts; | 163 TimeoutMap m_timeouts; |
| 172 int m_timerNestingLevel; | 164 int m_timerNestingLevel; |
| 173 | 165 |
| 174 bool m_inDispatchErrorEvent; | 166 bool m_inDispatchErrorEvent; |
| 175 class PendingException; | 167 class PendingException; |
| 176 OwnPtrWillBeMember<WillBeHeapVector<OwnPtrWillBeMember<PendingException> > >
m_pendingExceptions; | 168 OwnPtrWillBeMember<WillBeHeapVector<OwnPtrWillBeMember<PendingException> > >
m_pendingExceptions; |
| 177 | 169 |
| 178 bool m_activeDOMObjectsAreSuspended; | 170 bool m_activeDOMObjectsAreSuspended; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 190 // Counter that keeps track of how many window focus calls are allowed for | 182 // Counter that keeps track of how many window focus calls are allowed for |
| 191 // this ExecutionContext. Callers are expected to call |allowWindowFocus()| | 183 // this ExecutionContext. Callers are expected to call |allowWindowFocus()| |
| 192 // and |consumeWindowFocus()| in order to increment and decrement the | 184 // and |consumeWindowFocus()| in order to increment and decrement the |
| 193 // counter. | 185 // counter. |
| 194 int m_windowFocusTokens; | 186 int m_windowFocusTokens; |
| 195 }; | 187 }; |
| 196 | 188 |
| 197 } // namespace blink | 189 } // namespace blink |
| 198 | 190 |
| 199 #endif // ExecutionContext_h | 191 #endif // ExecutionContext_h |
| OLD | NEW |