| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 , m_referrerPolicy(ReferrerPolicyDefault) | 71 , m_referrerPolicy(ReferrerPolicyDefault) |
| 72 { | 72 { |
| 73 } | 73 } |
| 74 | 74 |
| 75 ExecutionContext::~ExecutionContext() | 75 ExecutionContext::~ExecutionContext() |
| 76 { | 76 { |
| 77 } | 77 } |
| 78 | 78 |
| 79 void ExecutionContext::suspendActiveDOMObjects() | 79 void ExecutionContext::suspendActiveDOMObjects() |
| 80 { | 80 { |
| 81 ASSERT(!m_activeDOMObjectsAreSuspended); | 81 DCHECK(!m_activeDOMObjectsAreSuspended); |
| 82 notifySuspendingActiveDOMObjects(); | 82 notifySuspendingActiveDOMObjects(); |
| 83 m_activeDOMObjectsAreSuspended = true; | 83 m_activeDOMObjectsAreSuspended = true; |
| 84 } | 84 } |
| 85 | 85 |
| 86 void ExecutionContext::resumeActiveDOMObjects() | 86 void ExecutionContext::resumeActiveDOMObjects() |
| 87 { | 87 { |
| 88 ASSERT(m_activeDOMObjectsAreSuspended); | 88 DCHECK(m_activeDOMObjectsAreSuspended); |
| 89 m_activeDOMObjectsAreSuspended = false; | 89 m_activeDOMObjectsAreSuspended = false; |
| 90 notifyResumingActiveDOMObjects(); | 90 notifyResumingActiveDOMObjects(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void ExecutionContext::stopActiveDOMObjects() | 93 void ExecutionContext::stopActiveDOMObjects() |
| 94 { | 94 { |
| 95 m_activeDOMObjectsAreStopped = true; | 95 m_activeDOMObjectsAreStopped = true; |
| 96 notifyStoppingActiveDOMObjects(); | 96 notifyStoppingActiveDOMObjects(); |
| 97 } | 97 } |
| 98 | 98 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 124 tasksWereResumed(); | 124 tasksWereResumed(); |
| 125 // We need finish stack unwiding before running next task because it can sus
pend this context. | 125 // We need finish stack unwiding before running next task because it can sus
pend this context. |
| 126 if (m_isRunSuspendableTasksScheduled) | 126 if (m_isRunSuspendableTasksScheduled) |
| 127 return; | 127 return; |
| 128 m_isRunSuspendableTasksScheduled = true; | 128 m_isRunSuspendableTasksScheduled = true; |
| 129 postTask(BLINK_FROM_HERE, createSameThreadTask(&ExecutionContext::runSuspend
ableTasks, this)); | 129 postTask(BLINK_FROM_HERE, createSameThreadTask(&ExecutionContext::runSuspend
ableTasks, this)); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void ExecutionContext::suspendActiveDOMObjectIfNeeded(ActiveDOMObject* object) | 132 void ExecutionContext::suspendActiveDOMObjectIfNeeded(ActiveDOMObject* object) |
| 133 { | 133 { |
| 134 ASSERT(contains(object)); | 134 #if DCHECK_IS_ON() |
| 135 DCHECK(contains(object)); |
| 136 #endif |
| 135 // Ensure all ActiveDOMObjects are suspended also newly created ones. | 137 // Ensure all ActiveDOMObjects are suspended also newly created ones. |
| 136 if (m_activeDOMObjectsAreSuspended) | 138 if (m_activeDOMObjectsAreSuspended) |
| 137 object->suspend(); | 139 object->suspend(); |
| 138 } | 140 } |
| 139 | 141 |
| 140 bool ExecutionContext::shouldSanitizeScriptError(const String& sourceURL, Access
ControlStatus corsStatus) | 142 bool ExecutionContext::shouldSanitizeScriptError(const String& sourceURL, Access
ControlStatus corsStatus) |
| 141 { | 143 { |
| 142 if (corsStatus == OpaqueResource) | 144 if (corsStatus == OpaqueResource) |
| 143 return true; | 145 return true; |
| 144 return !(getSecurityOrigin()->canRequestNoSuborigin(completeURL(sourceURL))
|| corsStatus == SharableCrossOrigin); | 146 return !(getSecurityOrigin()->canRequestNoSuborigin(completeURL(sourceURL))
|| corsStatus == SharableCrossOrigin); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 171 bool ExecutionContext::dispatchErrorEvent(RawPtr<ErrorEvent> event, AccessContro
lStatus corsStatus) | 173 bool ExecutionContext::dispatchErrorEvent(RawPtr<ErrorEvent> event, AccessContro
lStatus corsStatus) |
| 172 { | 174 { |
| 173 EventTarget* target = errorEventTarget(); | 175 EventTarget* target = errorEventTarget(); |
| 174 if (!target) | 176 if (!target) |
| 175 return false; | 177 return false; |
| 176 | 178 |
| 177 RawPtr<ErrorEvent> errorEvent = event; | 179 RawPtr<ErrorEvent> errorEvent = event; |
| 178 if (shouldSanitizeScriptError(errorEvent->filename(), corsStatus)) | 180 if (shouldSanitizeScriptError(errorEvent->filename(), corsStatus)) |
| 179 errorEvent = ErrorEvent::createSanitizedError(errorEvent->world()); | 181 errorEvent = ErrorEvent::createSanitizedError(errorEvent->world()); |
| 180 | 182 |
| 181 ASSERT(!m_inDispatchErrorEvent); | 183 DCHECK(!m_inDispatchErrorEvent); |
| 182 m_inDispatchErrorEvent = true; | 184 m_inDispatchErrorEvent = true; |
| 183 target->dispatchEvent(errorEvent); | 185 target->dispatchEvent(errorEvent); |
| 184 m_inDispatchErrorEvent = false; | 186 m_inDispatchErrorEvent = false; |
| 185 return errorEvent->defaultPrevented(); | 187 return errorEvent->defaultPrevented(); |
| 186 } | 188 } |
| 187 | 189 |
| 188 void ExecutionContext::runSuspendableTasks() | 190 void ExecutionContext::runSuspendableTasks() |
| 189 { | 191 { |
| 190 m_isRunSuspendableTasksScheduled = false; | 192 m_isRunSuspendableTasksScheduled = false; |
| 191 while (!m_activeDOMObjectsAreSuspended && m_suspendedTasks.size()) { | 193 while (!m_activeDOMObjectsAreSuspended && m_suspendedTasks.size()) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 } | 276 } |
| 275 | 277 |
| 276 DEFINE_TRACE(ExecutionContext) | 278 DEFINE_TRACE(ExecutionContext) |
| 277 { | 279 { |
| 278 visitor->trace(m_publicURLManager); | 280 visitor->trace(m_publicURLManager); |
| 279 ContextLifecycleNotifier::trace(visitor); | 281 ContextLifecycleNotifier::trace(visitor); |
| 280 Supplementable<ExecutionContext>::trace(visitor); | 282 Supplementable<ExecutionContext>::trace(visitor); |
| 281 } | 283 } |
| 282 | 284 |
| 283 } // namespace blink | 285 } // namespace blink |
| OLD | NEW |