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 20 matching lines...) Expand all Loading... |
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/frame/UseCounter.h" |
36 #include "core/html/PublicURLManager.h" | 36 #include "core/html/PublicURLManager.h" |
37 #include "core/inspector/InspectorInstrumentation.h" | 37 #include "core/inspector/InspectorInstrumentation.h" |
38 #include "core/inspector/ScriptCallStack.h" | 38 #include "core/inspector/ScriptCallStack.h" |
39 #include "core/workers/WorkerGlobalScope.h" | 39 #include "core/workers/WorkerGlobalScope.h" |
40 #include "core/workers/WorkerThread.h" | 40 #include "core/workers/WorkerThread.h" |
| 41 #include "platform/RuntimeEnabledFeatures.h" |
41 #include "wtf/MainThread.h" | 42 #include "wtf/MainThread.h" |
42 | 43 |
43 namespace blink { | 44 namespace blink { |
44 | 45 |
45 class ExecutionContext::PendingException : public NoBaseWillBeGarbageCollectedFi
nalized<ExecutionContext::PendingException> { | 46 class ExecutionContext::PendingException : public NoBaseWillBeGarbageCollectedFi
nalized<ExecutionContext::PendingException> { |
46 WTF_MAKE_NONCOPYABLE(PendingException); | 47 WTF_MAKE_NONCOPYABLE(PendingException); |
47 public: | 48 public: |
48 PendingException(const String& errorMessage, int lineNumber, int columnNumbe
r, int scriptId, const String& sourceURL, PassRefPtrWillBeRawPtr<ScriptCallStack
> callStack) | 49 PendingException(const String& errorMessage, int lineNumber, int columnNumbe
r, int scriptId, const String& sourceURL, PassRefPtrWillBeRawPtr<ScriptCallStack
> callStack) |
49 : m_errorMessage(errorMessage) | 50 : m_errorMessage(errorMessage) |
50 , m_lineNumber(lineNumber) | 51 , m_lineNumber(lineNumber) |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 const KURL& ExecutionContext::url() const | 229 const KURL& ExecutionContext::url() const |
229 { | 230 { |
230 return virtualURL(); | 231 return virtualURL(); |
231 } | 232 } |
232 | 233 |
233 KURL ExecutionContext::completeURL(const String& url) const | 234 KURL ExecutionContext::completeURL(const String& url) const |
234 { | 235 { |
235 return virtualCompleteURL(url); | 236 return virtualCompleteURL(url); |
236 } | 237 } |
237 | 238 |
| 239 bool ExecutionContext::hasSuborigin() |
| 240 { |
| 241 return securityContext().securityOrigin()->hasSuborigin(); |
| 242 } |
| 243 |
| 244 String ExecutionContext::suboriginName() |
| 245 { |
| 246 return securityContext().securityOrigin()->suboriginName(); |
| 247 } |
| 248 |
238 void ExecutionContext::allowWindowInteraction() | 249 void ExecutionContext::allowWindowInteraction() |
239 { | 250 { |
240 ++m_windowInteractionTokens; | 251 ++m_windowInteractionTokens; |
241 } | 252 } |
242 | 253 |
243 void ExecutionContext::consumeWindowInteraction() | 254 void ExecutionContext::consumeWindowInteraction() |
244 { | 255 { |
245 if (m_windowInteractionTokens == 0) | 256 if (m_windowInteractionTokens == 0) |
246 return; | 257 return; |
247 --m_windowInteractionTokens; | 258 --m_windowInteractionTokens; |
(...skipping 12 matching lines...) Expand all Loading... |
260 UseCounter::count(this, UseCounter::ResetReferrerPolicy); | 271 UseCounter::count(this, UseCounter::ResetReferrerPolicy); |
261 | 272 |
262 m_referrerPolicy = referrerPolicy; | 273 m_referrerPolicy = referrerPolicy; |
263 } | 274 } |
264 | 275 |
265 void ExecutionContext::removeURLFromMemoryCache(const KURL& url) | 276 void ExecutionContext::removeURLFromMemoryCache(const KURL& url) |
266 { | 277 { |
267 memoryCache()->removeURLFromCache(url); | 278 memoryCache()->removeURLFromCache(url); |
268 } | 279 } |
269 | 280 |
| 281 // |name| should be non-empty, and this should be enforced by parsing. |
| 282 void ExecutionContext::enforceSuborigin(const String& name) |
| 283 { |
| 284 if (name.isNull()) |
| 285 return; |
| 286 ASSERT(!name.isEmpty()); |
| 287 ASSERT(RuntimeEnabledFeatures::suboriginsEnabled()); |
| 288 SecurityOrigin* origin = securityContext().securityOrigin(); |
| 289 ASSERT(origin); |
| 290 ASSERT(!origin->hasSuborigin() || origin->suboriginName() == name); |
| 291 origin->addSuborigin(name); |
| 292 securityContext().didUpdateSecurityOrigin(); |
| 293 } |
| 294 |
270 DEFINE_TRACE(ExecutionContext) | 295 DEFINE_TRACE(ExecutionContext) |
271 { | 296 { |
272 #if ENABLE(OILPAN) | 297 #if ENABLE(OILPAN) |
273 visitor->trace(m_pendingExceptions); | 298 visitor->trace(m_pendingExceptions); |
274 visitor->trace(m_publicURLManager); | 299 visitor->trace(m_publicURLManager); |
275 HeapSupplementable<ExecutionContext>::trace(visitor); | 300 HeapSupplementable<ExecutionContext>::trace(visitor); |
276 #endif | 301 #endif |
277 ContextLifecycleNotifier::trace(visitor); | 302 ContextLifecycleNotifier::trace(visitor); |
278 } | 303 } |
279 | 304 |
280 } // namespace blink | 305 } // namespace blink |
OLD | NEW |