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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 class ContextLifecycleNotifier; | 48 class ContextLifecycleNotifier; |
49 class LocalDOMWindow; | 49 class LocalDOMWindow; |
50 class ErrorEvent; | 50 class ErrorEvent; |
51 class EventQueue; | 51 class EventQueue; |
52 class ExecutionContextTask; | 52 class ExecutionContextTask; |
53 class ScriptState; | 53 class ScriptState; |
54 class PublicURLManager; | 54 class PublicURLManager; |
55 class SecurityOrigin; | 55 class SecurityOrigin; |
56 class ScriptCallStack; | 56 class ScriptCallStack; |
| 57 class ConsoleMessage; |
57 | 58 |
58 class ExecutionContext | 59 class ExecutionContext |
59 : public WillBeGarbageCollectedMixin | 60 : public WillBeGarbageCollectedMixin |
60 , public LifecycleContext<ExecutionContext> | 61 , public LifecycleContext<ExecutionContext> |
61 , public Supplementable<ExecutionContext> { | 62 , public Supplementable<ExecutionContext> { |
62 public: | 63 public: |
63 virtual void trace(Visitor*); | 64 virtual void trace(Visitor*); |
64 | 65 |
65 // Delegating to ExecutionContextClient | 66 // Delegating to ExecutionContextClient |
66 bool isDocument() const { return m_client && m_client->isDocument(); } | 67 bool isDocument() const { return m_client && m_client->isDocument(); } |
67 bool isWorkerGlobalScope() const { return m_client && m_client->isWorkerGlob
alScope(); } | 68 bool isWorkerGlobalScope() const { return m_client && m_client->isWorkerGlob
alScope(); } |
68 bool isJSExecutionForbidden() { return m_client && m_client->isJSExecutionFo
rbidden(); } | 69 bool isJSExecutionForbidden() { return m_client && m_client->isJSExecutionFo
rbidden(); } |
69 SecurityOrigin* securityOrigin() const; | 70 SecurityOrigin* securityOrigin() const; |
70 ContentSecurityPolicy* contentSecurityPolicy() const; | 71 ContentSecurityPolicy* contentSecurityPolicy() const; |
71 const KURL& url() const; | 72 const KURL& url() const; |
72 KURL completeURL(const String& url) const; | 73 KURL completeURL(const String& url) const; |
73 void disableEval(const String& errorMessage); | 74 void disableEval(const String& errorMessage); |
74 LocalDOMWindow* executingWindow() const; | 75 LocalDOMWindow* executingWindow() const; |
75 String userAgent(const KURL&) const; | 76 String userAgent(const KURL&) const; |
76 void postTask(PassOwnPtr<ExecutionContextTask>); | 77 void postTask(PassOwnPtr<ExecutionContextTask>); |
77 double timerAlignmentInterval() const; | 78 double timerAlignmentInterval() const; |
78 | 79 |
79 virtual void reportBlockedScriptExecutionToInspector(const String& directive
Text) = 0; | 80 virtual void reportBlockedScriptExecutionToInspector(const String& directive
Text) = 0; |
80 | 81 |
81 virtual SecurityContext& securityContext() = 0; | 82 virtual SecurityContext& securityContext() = 0; |
82 KURL contextURL() const { return virtualURL(); } | 83 KURL contextURL() const { return virtualURL(); } |
83 KURL contextCompleteURL(const String& url) const { return virtualCompleteURL
(url); } | 84 KURL contextCompleteURL(const String& url) const { return virtualCompleteURL
(url); } |
84 | 85 |
85 bool shouldSanitizeScriptError(const String& sourceURL, AccessControlStatus)
; | 86 bool shouldSanitizeScriptError(const String& sourceURL, AccessControlStatus)
; |
86 void reportException(PassRefPtrWillBeRawPtr<ErrorEvent>, PassRefPtrWillBeRaw
Ptr<ScriptCallStack>, AccessControlStatus); | 87 void reportException(PassRefPtrWillBeRawPtr<ErrorEvent>, PassRefPtr<ConsoleM
essage>); |
87 | 88 |
88 void addConsoleMessage(MessageSource, MessageLevel, const String& message, c
onst String& sourceURL, unsigned lineNumber); | 89 void addConsoleMessage(MessageSource, MessageLevel, const String& message, c
onst String& sourceURL = String(), unsigned lineNumber = 0); |
89 void addConsoleMessage(MessageSource, MessageLevel, const String& message, S
criptState* = 0); | 90 void addConsoleMessage(MessageSource, MessageLevel, const String& message, P
assRefPtr<ScriptCallStack>); |
90 | 91 |
91 PublicURLManager& publicURLManager(); | 92 PublicURLManager& publicURLManager(); |
92 | 93 |
93 // Active objects are not garbage collected even if inaccessible, e.g. becau
se their activity may result in callbacks being invoked. | 94 // Active objects are not garbage collected even if inaccessible, e.g. becau
se their activity may result in callbacks being invoked. |
94 bool hasPendingActivity(); | 95 bool hasPendingActivity(); |
95 | 96 |
96 void suspendActiveDOMObjects(); | 97 void suspendActiveDOMObjects(); |
97 void resumeActiveDOMObjects(); | 98 void resumeActiveDOMObjects(); |
98 void stopActiveDOMObjects(); | 99 void stopActiveDOMObjects(); |
99 unsigned activeDOMObjectCount(); | 100 unsigned activeDOMObjectCount(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 171 |
171 // The location of this member is important; to make sure contextDestroyed()
notification on | 172 // The location of this member is important; to make sure contextDestroyed()
notification on |
172 // ExecutionContext's members (notably m_timeouts) is called before they are
destructed, | 173 // ExecutionContext's members (notably m_timeouts) is called before they are
destructed, |
173 // m_lifecycleNotifer should be placed *after* such members. | 174 // m_lifecycleNotifer should be placed *after* such members. |
174 OwnPtr<ContextLifecycleNotifier> m_lifecycleNotifier; | 175 OwnPtr<ContextLifecycleNotifier> m_lifecycleNotifier; |
175 }; | 176 }; |
176 | 177 |
177 } // namespace WebCore | 178 } // namespace WebCore |
178 | 179 |
179 #endif // ExecutionContext_h | 180 #endif // ExecutionContext_h |
OLD | NEW |