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 19 matching lines...) Expand all Loading... |
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/html/PublicURLManager.h" | 34 #include "core/html/PublicURLManager.h" |
35 #include "core/inspector/InspectorInstrumentation.h" | 35 #include "core/inspector/InspectorInstrumentation.h" |
36 #include "core/inspector/ScriptCallStack.h" | 36 #include "core/inspector/ScriptCallStack.h" |
37 #include "core/page/WindowFocusAllowedIndicator.h" | 37 #include "core/page/WindowFocusAllowedIndicator.h" |
38 #include "core/workers/WorkerGlobalScope.h" | 38 #include "core/workers/WorkerGlobalScope.h" |
39 #include "core/workers/WorkerThread.h" | 39 #include "core/workers/WorkerThread.h" |
| 40 #include "platform/RuntimeEnabledFeatures.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> { |
45 WTF_MAKE_NONCOPYABLE(PendingException); | 46 WTF_MAKE_NONCOPYABLE(PendingException); |
46 public: | 47 public: |
47 PendingException(const String& errorMessage, int lineNumber, int columnNumbe
r, int scriptId, const String& sourceURL, PassRefPtrWillBeRawPtr<ScriptCallStack
> callStack) | 48 PendingException(const String& errorMessage, int lineNumber, int columnNumbe
r, int scriptId, const String& sourceURL, PassRefPtrWillBeRawPtr<ScriptCallStack
> callStack) |
48 : m_errorMessage(errorMessage) | 49 : m_errorMessage(errorMessage) |
49 , m_lineNumber(lineNumber) | 50 , m_lineNumber(lineNumber) |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 } | 220 } |
220 | 221 |
221 bool ExecutionContext::isWindowInteractionAllowed() const | 222 bool ExecutionContext::isWindowInteractionAllowed() const |
222 { | 223 { |
223 // FIXME: WindowFocusAllowedIndicator::windowFocusAllowed() is temporary, | 224 // FIXME: WindowFocusAllowedIndicator::windowFocusAllowed() is temporary, |
224 // it will be removed as soon as WebScopedWindowFocusAllowedIndicator will | 225 // it will be removed as soon as WebScopedWindowFocusAllowedIndicator will |
225 // be updated to not use WindowFocusAllowedIndicator. | 226 // be updated to not use WindowFocusAllowedIndicator. |
226 return m_windowInteractionTokens > 0 || WindowFocusAllowedIndicator::windowF
ocusAllowed(); | 227 return m_windowInteractionTokens > 0 || WindowFocusAllowedIndicator::windowF
ocusAllowed(); |
227 } | 228 } |
228 | 229 |
| 230 // |name| should be non-empty, and this should be enforced by parsing. |
| 231 void ExecutionContext::enforceSuborigin(const String& name) |
| 232 { |
| 233 if (name.isNull()) |
| 234 return; |
| 235 ASSERT(!name.isEmpty()); |
| 236 ASSERT(RuntimeEnabledFeatures::suboriginsEnabled()); |
| 237 SecurityOrigin* origin = securityContext().securityOrigin(); |
| 238 ASSERT(origin); |
| 239 ASSERT(!origin->hasSuborigin() || origin->suboriginName() == name); |
| 240 origin->addSuborigin(name); |
| 241 securityContext().didUpdateSecurityOrigin(); |
| 242 } |
| 243 |
229 DEFINE_TRACE(ExecutionContext) | 244 DEFINE_TRACE(ExecutionContext) |
230 { | 245 { |
231 #if ENABLE(OILPAN) | 246 #if ENABLE(OILPAN) |
232 visitor->trace(m_pendingExceptions); | 247 visitor->trace(m_pendingExceptions); |
233 visitor->trace(m_publicURLManager); | 248 visitor->trace(m_publicURLManager); |
234 HeapSupplementable<ExecutionContext>::trace(visitor); | 249 HeapSupplementable<ExecutionContext>::trace(visitor); |
235 #endif | 250 #endif |
236 ContextLifecycleNotifier::trace(visitor); | 251 ContextLifecycleNotifier::trace(visitor); |
237 } | 252 } |
238 | 253 |
239 } // namespace blink | 254 } // namespace blink |
OLD | NEW |