Chromium Code Reviews| 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 14 matching lines...) Expand all Loading... | |
| 25 * | 25 * |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #include "config.h" | 28 #include "config.h" |
| 29 #include "core/dom/ExecutionContext.h" | 29 #include "core/dom/ExecutionContext.h" |
| 30 | 30 |
| 31 #include "core/dom/ExecutionContextTask.h" | 31 #include "core/dom/ExecutionContextTask.h" |
| 32 #include "core/events/ErrorEvent.h" | 32 #include "core/events/ErrorEvent.h" |
| 33 #include "core/events/EventTarget.h" | 33 #include "core/events/EventTarget.h" |
| 34 #include "core/fetch/MemoryCache.h" | 34 #include "core/fetch/MemoryCache.h" |
| 35 #include "core/frame/UseCounter.h" | |
| 35 #include "core/html/PublicURLManager.h" | 36 #include "core/html/PublicURLManager.h" |
| 36 #include "core/inspector/InspectorInstrumentation.h" | 37 #include "core/inspector/InspectorInstrumentation.h" |
| 37 #include "core/inspector/ScriptCallStack.h" | 38 #include "core/inspector/ScriptCallStack.h" |
| 38 #include "core/workers/WorkerGlobalScope.h" | 39 #include "core/workers/WorkerGlobalScope.h" |
| 39 #include "core/workers/WorkerThread.h" | 40 #include "core/workers/WorkerThread.h" |
| 40 #include "wtf/MainThread.h" | 41 #include "wtf/MainThread.h" |
| 41 | 42 |
| 42 namespace blink { | 43 namespace blink { |
| 43 | 44 |
| 44 class ExecutionContext::PendingException : public NoBaseWillBeGarbageCollectedFi nalized<ExecutionContext::PendingException> { | 45 class ExecutionContext::PendingException : public NoBaseWillBeGarbageCollectedFi nalized<ExecutionContext::PendingException> { |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 66 }; | 67 }; |
| 67 | 68 |
| 68 ExecutionContext::ExecutionContext() | 69 ExecutionContext::ExecutionContext() |
| 69 : m_circularSequentialID(0) | 70 : m_circularSequentialID(0) |
| 70 , m_inDispatchErrorEvent(false) | 71 , m_inDispatchErrorEvent(false) |
| 71 , m_activeDOMObjectsAreSuspended(false) | 72 , m_activeDOMObjectsAreSuspended(false) |
| 72 , m_activeDOMObjectsAreStopped(false) | 73 , m_activeDOMObjectsAreStopped(false) |
| 73 , m_strictMixedContentCheckingEnforced(false) | 74 , m_strictMixedContentCheckingEnforced(false) |
| 74 , m_windowInteractionTokens(0) | 75 , m_windowInteractionTokens(0) |
| 75 , m_isRunSuspendableTasksScheduled(false) | 76 , m_isRunSuspendableTasksScheduled(false) |
| 77 , m_referrerPolicy(ReferrerPolicyDefault) | |
| 76 { | 78 { |
| 77 } | 79 } |
| 78 | 80 |
| 79 ExecutionContext::~ExecutionContext() | 81 ExecutionContext::~ExecutionContext() |
| 80 { | 82 { |
| 81 } | 83 } |
| 82 | 84 |
| 83 void ExecutionContext::suspendActiveDOMObjects() | 85 void ExecutionContext::suspendActiveDOMObjects() |
| 84 { | 86 { |
| 85 ASSERT(!m_activeDOMObjectsAreSuspended); | 87 ASSERT(!m_activeDOMObjectsAreSuspended); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 241 if (m_windowInteractionTokens == 0) | 243 if (m_windowInteractionTokens == 0) |
| 242 return; | 244 return; |
| 243 --m_windowInteractionTokens; | 245 --m_windowInteractionTokens; |
| 244 } | 246 } |
| 245 | 247 |
| 246 bool ExecutionContext::isWindowInteractionAllowed() const | 248 bool ExecutionContext::isWindowInteractionAllowed() const |
| 247 { | 249 { |
| 248 return m_windowInteractionTokens > 0; | 250 return m_windowInteractionTokens > 0; |
| 249 } | 251 } |
| 250 | 252 |
| 253 void ExecutionContext::setReferrerPolicy(ReferrerPolicy referrerPolicy) | |
| 254 { | |
| 255 // FIXME: Can we adopt the CSP referrer policy merge algorithm? Or does the web rely on being able to modify the referrer policy in-flight? | |
| 256 UseCounter::count(this, UseCounter::SetReferrerPolicy); | |
| 257 if (m_referrerPolicy != ReferrerPolicyDefault) | |
|
jochen (gone - plz use gerrit)
2015/05/04 07:20:31
i notice this is just copy/paste, but shouldn't th
Mike West
2015/05/04 14:17:20
I don't think so. If the referrer policy is the de
jochen (gone - plz use gerrit)
2015/05/04 14:36:12
ah, right
| |
| 258 UseCounter::count(this, UseCounter::ResetReferrerPolicy); | |
| 259 | |
| 260 m_referrerPolicy = referrerPolicy; | |
| 261 } | |
| 262 | |
| 251 void ExecutionContext::removeURLFromMemoryCache(const KURL& url) | 263 void ExecutionContext::removeURLFromMemoryCache(const KURL& url) |
| 252 { | 264 { |
| 253 memoryCache()->removeURLFromCache(url); | 265 memoryCache()->removeURLFromCache(url); |
| 254 } | 266 } |
| 255 | 267 |
| 256 DEFINE_TRACE(ExecutionContext) | 268 DEFINE_TRACE(ExecutionContext) |
| 257 { | 269 { |
| 258 #if ENABLE(OILPAN) | 270 #if ENABLE(OILPAN) |
| 259 visitor->trace(m_pendingExceptions); | 271 visitor->trace(m_pendingExceptions); |
| 260 visitor->trace(m_publicURLManager); | 272 visitor->trace(m_publicURLManager); |
| 261 HeapSupplementable<ExecutionContext>::trace(visitor); | 273 HeapSupplementable<ExecutionContext>::trace(visitor); |
| 262 #endif | 274 #endif |
| 263 ContextLifecycleNotifier::trace(visitor); | 275 ContextLifecycleNotifier::trace(visitor); |
| 264 } | 276 } |
| 265 | 277 |
| 266 } // namespace blink | 278 } // namespace blink |
| OLD | NEW |