| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 ExecutionContext::ExecutionContext() | 48 ExecutionContext::ExecutionContext() |
| 49 : m_circularSequentialID(0), | 49 : m_circularSequentialID(0), |
| 50 m_inDispatchErrorEvent(false), | 50 m_inDispatchErrorEvent(false), |
| 51 m_activeDOMObjectsAreSuspended(false), | 51 m_activeDOMObjectsAreSuspended(false), |
| 52 m_isContextDestroyed(false), | 52 m_isContextDestroyed(false), |
| 53 m_windowInteractionTokens(0), | 53 m_windowInteractionTokens(0), |
| 54 m_referrerPolicy(ReferrerPolicyDefault) {} | 54 m_referrerPolicy(ReferrerPolicyDefault) {} |
| 55 | 55 |
| 56 ExecutionContext::~ExecutionContext() {} | 56 ExecutionContext::~ExecutionContext() {} |
| 57 | 57 |
| 58 void ExecutionContext::suspendActiveDOMObjects() { | 58 void ExecutionContext::suspendSuspendableObjects() { |
| 59 DCHECK(!m_activeDOMObjectsAreSuspended); | 59 DCHECK(!m_activeDOMObjectsAreSuspended); |
| 60 notifySuspendingActiveDOMObjects(); | 60 notifySuspendingSuspendableObjects(); |
| 61 m_activeDOMObjectsAreSuspended = true; | 61 m_activeDOMObjectsAreSuspended = true; |
| 62 } | 62 } |
| 63 | 63 |
| 64 void ExecutionContext::resumeActiveDOMObjects() { | 64 void ExecutionContext::resumeSuspendableObjects() { |
| 65 DCHECK(m_activeDOMObjectsAreSuspended); | 65 DCHECK(m_activeDOMObjectsAreSuspended); |
| 66 m_activeDOMObjectsAreSuspended = false; | 66 m_activeDOMObjectsAreSuspended = false; |
| 67 notifyResumingActiveDOMObjects(); | 67 notifyResumingSuspendableObjects(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void ExecutionContext::notifyContextDestroyed() { | 70 void ExecutionContext::notifyContextDestroyed() { |
| 71 m_isContextDestroyed = true; | 71 m_isContextDestroyed = true; |
| 72 ContextLifecycleNotifier::notifyContextDestroyed(); | 72 ContextLifecycleNotifier::notifyContextDestroyed(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void ExecutionContext::suspendScheduledTasks() { | 75 void ExecutionContext::suspendScheduledTasks() { |
| 76 suspendActiveDOMObjects(); | 76 suspendSuspendableObjects(); |
| 77 tasksWereSuspended(); | 77 tasksWereSuspended(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void ExecutionContext::resumeScheduledTasks() { | 80 void ExecutionContext::resumeScheduledTasks() { |
| 81 resumeActiveDOMObjects(); | 81 resumeSuspendableObjects(); |
| 82 tasksWereResumed(); | 82 tasksWereResumed(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void ExecutionContext::suspendActiveDOMObjectIfNeeded(ActiveDOMObject* object) { | 85 void ExecutionContext::suspendSuspendableObjectIfNeeded( |
| 86 SuspendableObject* object) { |
| 86 #if DCHECK_IS_ON() | 87 #if DCHECK_IS_ON() |
| 87 DCHECK(contains(object)); | 88 DCHECK(contains(object)); |
| 88 #endif | 89 #endif |
| 89 // Ensure all ActiveDOMObjects are suspended also newly created ones. | 90 // Ensure all SuspendableObjects are suspended also newly created ones. |
| 90 if (m_activeDOMObjectsAreSuspended) | 91 if (m_activeDOMObjectsAreSuspended) |
| 91 object->suspend(); | 92 object->suspend(); |
| 92 } | 93 } |
| 93 | 94 |
| 94 bool ExecutionContext::shouldSanitizeScriptError( | 95 bool ExecutionContext::shouldSanitizeScriptError( |
| 95 const String& sourceURL, | 96 const String& sourceURL, |
| 96 AccessControlStatus corsStatus) { | 97 AccessControlStatus corsStatus) { |
| 97 if (corsStatus == OpaqueResource) | 98 if (corsStatus == OpaqueResource) |
| 98 return true; | 99 return true; |
| 99 return !(getSecurityOrigin()->canRequestNoSuborigin(completeURL(sourceURL)) || | 100 return !(getSecurityOrigin()->canRequestNoSuborigin(completeURL(sourceURL)) || |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 } | 246 } |
| 246 | 247 |
| 247 DEFINE_TRACE(ExecutionContext) { | 248 DEFINE_TRACE(ExecutionContext) { |
| 248 visitor->trace(m_publicURLManager); | 249 visitor->trace(m_publicURLManager); |
| 249 visitor->trace(m_pendingExceptions); | 250 visitor->trace(m_pendingExceptions); |
| 250 ContextLifecycleNotifier::trace(visitor); | 251 ContextLifecycleNotifier::trace(visitor); |
| 251 Supplementable<ExecutionContext>::trace(visitor); | 252 Supplementable<ExecutionContext>::trace(visitor); |
| 252 } | 253 } |
| 253 | 254 |
| 254 } // namespace blink | 255 } // namespace blink |
| OLD | NEW |