| 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 10 matching lines...) Expand all Loading... |
| 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 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 "bindings/core/v8/ScriptState.h" |
| 31 #include "core/CoreExport.h" | 32 #include "core/CoreExport.h" |
| 32 #include "core/dom/ContextLifecycleNotifier.h" | 33 #include "core/dom/ContextLifecycleNotifier.h" |
| 33 #include "core/dom/ContextLifecycleObserver.h" | 34 #include "core/dom/ContextLifecycleObserver.h" |
| 34 #include "core/dom/SecurityContext.h" | 35 #include "core/dom/SecurityContext.h" |
| 35 #include "core/dom/SuspendableTask.h" | 36 #include "core/dom/SuspendableTask.h" |
| 36 #include "core/fetch/AccessControlStatus.h" | 37 #include "core/fetch/AccessControlStatus.h" |
| 37 #include "platform/Supplementable.h" | 38 #include "platform/Supplementable.h" |
| 38 #include "platform/heap/Handle.h" | 39 #include "platform/heap/Handle.h" |
| 39 #include "platform/weborigin/KURL.h" | 40 #include "platform/weborigin/KURL.h" |
| 40 #include "platform/weborigin/ReferrerPolicy.h" | 41 #include "platform/weborigin/ReferrerPolicy.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 // tokens are valid policies. | 173 // tokens are valid policies. |
| 173 // | 174 // |
| 174 // If |supportLegacyKeywords| is true, then the legacy keywords | 175 // If |supportLegacyKeywords| is true, then the legacy keywords |
| 175 // "never", "default", "always", and "origin-when-crossorigin" are | 176 // "never", "default", "always", and "origin-when-crossorigin" are |
| 176 // parsed as valid policies. | 177 // parsed as valid policies. |
| 177 void parseAndSetReferrerPolicy(const String& policies, | 178 void parseAndSetReferrerPolicy(const String& policies, |
| 178 bool supportLegacyKeywords = false); | 179 bool supportLegacyKeywords = false); |
| 179 void setReferrerPolicy(ReferrerPolicy); | 180 void setReferrerPolicy(ReferrerPolicy); |
| 180 virtual ReferrerPolicy getReferrerPolicy() const { return m_referrerPolicy; } | 181 virtual ReferrerPolicy getReferrerPolicy() const { return m_referrerPolicy; } |
| 181 | 182 |
| 183 void setErrorEventScriptState(ScriptState* scriptState) { m_errorEventScriptSt
ate = scriptState; } |
| 184 void clearErrorEventScriptState() { m_errorEventScriptState.clear(); } |
| 185 ScriptState* errorEventScriptState() { return m_errorEventScriptState.get(); } |
| 186 |
| 182 protected: | 187 protected: |
| 183 ExecutionContext(); | 188 ExecutionContext(); |
| 184 virtual ~ExecutionContext(); | 189 virtual ~ExecutionContext(); |
| 185 | 190 |
| 186 virtual const KURL& virtualURL() const = 0; | 191 virtual const KURL& virtualURL() const = 0; |
| 187 virtual KURL virtualCompleteURL(const String&) const = 0; | 192 virtual KURL virtualCompleteURL(const String&) const = 0; |
| 188 | 193 |
| 189 private: | 194 private: |
| 190 bool dispatchErrorEventInternal(ErrorEvent*, AccessControlStatus); | 195 bool dispatchErrorEventInternal(ErrorEvent*, AccessControlStatus); |
| 191 void runSuspendableTasks(); | 196 void runSuspendableTasks(); |
| 192 | 197 |
| 193 unsigned m_circularSequentialID; | 198 unsigned m_circularSequentialID; |
| 194 | 199 |
| 195 bool m_inDispatchErrorEvent; | 200 bool m_inDispatchErrorEvent; |
| 196 HeapVector<Member<ErrorEvent>> m_pendingExceptions; | 201 HeapVector<Member<ErrorEvent>> m_pendingExceptions; |
| 202 RefPtr<ScriptState> m_errorEventScriptState; |
| 197 | 203 |
| 198 bool m_activeDOMObjectsAreSuspended; | 204 bool m_activeDOMObjectsAreSuspended; |
| 199 bool m_activeDOMObjectsAreStopped; | 205 bool m_activeDOMObjectsAreStopped; |
| 200 | 206 |
| 201 Member<PublicURLManager> m_publicURLManager; | 207 Member<PublicURLManager> m_publicURLManager; |
| 202 | 208 |
| 203 // Counter that keeps track of how many window interaction calls are allowed | 209 // Counter that keeps track of how many window interaction calls are allowed |
| 204 // for this ExecutionContext. Callers are expected to call | 210 // for this ExecutionContext. Callers are expected to call |
| 205 // |allowWindowInteraction()| and |consumeWindowInteraction()| in order to | 211 // |allowWindowInteraction()| and |consumeWindowInteraction()| in order to |
| 206 // increment and decrement the counter. | 212 // increment and decrement the counter. |
| 207 int m_windowInteractionTokens; | 213 int m_windowInteractionTokens; |
| 208 | 214 |
| 209 Deque<std::unique_ptr<SuspendableTask>> m_suspendedTasks; | 215 Deque<std::unique_ptr<SuspendableTask>> m_suspendedTasks; |
| 210 bool m_isRunSuspendableTasksScheduled; | 216 bool m_isRunSuspendableTasksScheduled; |
| 211 | 217 |
| 212 ReferrerPolicy m_referrerPolicy; | 218 ReferrerPolicy m_referrerPolicy; |
| 213 }; | 219 }; |
| 214 | 220 |
| 215 } // namespace blink | 221 } // namespace blink |
| 216 | 222 |
| 217 #endif // ExecutionContext_h | 223 #endif // ExecutionContext_h |
| OLD | NEW |