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 12 matching lines...) Expand all Loading... |
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 * | 25 * |
26 */ | 26 */ |
27 | 27 |
28 #ifndef ScriptExecutionContext_h | 28 #ifndef ScriptExecutionContext_h |
29 #define ScriptExecutionContext_h | 29 #define ScriptExecutionContext_h |
30 | 30 |
31 #include "core/dom/ActiveDOMObject.h" | 31 #include "core/dom/ActiveDOMObject.h" |
32 #include "core/dom/SecurityContext.h" | 32 #include "core/dom/SecurityContext.h" |
| 33 #include "core/loader/CrossOriginAccessControl.h" |
33 #include "core/page/ConsoleTypes.h" | 34 #include "core/page/ConsoleTypes.h" |
34 #include "core/page/DOMTimer.h" | 35 #include "core/page/DOMTimer.h" |
35 #include "core/platform/LifecycleContext.h" | 36 #include "core/platform/LifecycleContext.h" |
36 #include "core/platform/Supplementable.h" | 37 #include "core/platform/Supplementable.h" |
37 #include "weborigin/KURL.h" | 38 #include "weborigin/KURL.h" |
38 #include "wtf/HashSet.h" | 39 #include "wtf/HashSet.h" |
39 #include "wtf/OwnPtr.h" | 40 #include "wtf/OwnPtr.h" |
40 #include "wtf/PassOwnPtr.h" | 41 #include "wtf/PassOwnPtr.h" |
41 | 42 |
42 namespace WebCore { | 43 namespace WebCore { |
(...skipping 18 matching lines...) Expand all Loading... |
61 | 62 |
62 virtual bool isJSExecutionForbidden() const = 0; | 63 virtual bool isJSExecutionForbidden() const = 0; |
63 | 64 |
64 const KURL& url() const { return virtualURL(); } | 65 const KURL& url() const { return virtualURL(); } |
65 KURL completeURL(const String& url) const { return virtualCompleteURL(url);
} | 66 KURL completeURL(const String& url) const { return virtualCompleteURL(url);
} |
66 | 67 |
67 virtual String userAgent(const KURL&) const = 0; | 68 virtual String userAgent(const KURL&) const = 0; |
68 | 69 |
69 virtual void disableEval(const String& errorMessage) = 0; | 70 virtual void disableEval(const String& errorMessage) = 0; |
70 | 71 |
71 bool sanitizeScriptError(String& errorMessage, int& lineNumber, int& columnN
umber, String& sourceURL); | 72 bool sanitizeScriptError(String& errorMessage, int& lineNumber, int& columnN
umber, String& sourceURL, ScriptAccessControlCheckStatus = ScriptIsNotSharedCros
sOrigin); |
72 void reportException(const String& errorMessage, int lineNumber, int columnN
umber, const String& sourceURL, PassRefPtr<ScriptCallStack>); | 73 void reportException(const String& errorMessage, int lineNumber, int columnN
umber, const String& sourceURL, PassRefPtr<ScriptCallStack>, ScriptAccessControl
CheckStatus = ScriptIsNotSharedCrossOrigin); |
73 | 74 |
74 void addConsoleMessage(MessageSource, MessageLevel, const String& message, c
onst String& sourceURL, unsigned lineNumber, ScriptState* = 0, unsigned long req
uestIdentifier = 0); | 75 void addConsoleMessage(MessageSource, MessageLevel, const String& message, c
onst String& sourceURL, unsigned lineNumber, ScriptState* = 0, unsigned long req
uestIdentifier = 0); |
75 virtual void addConsoleMessage(MessageSource, MessageLevel, const String& me
ssage, unsigned long requestIdentifier = 0) = 0; | 76 virtual void addConsoleMessage(MessageSource, MessageLevel, const String& me
ssage, unsigned long requestIdentifier = 0) = 0; |
76 | 77 |
77 PublicURLManager& publicURLManager(); | 78 PublicURLManager& publicURLManager(); |
78 | 79 |
79 // Active objects are not garbage collected even if inaccessible, e.g. becau
se their activity may result in callbacks being invoked. | 80 // Active objects are not garbage collected even if inaccessible, e.g. becau
se their activity may result in callbacks being invoked. |
80 bool canSuspendActiveDOMObjects(); | 81 bool canSuspendActiveDOMObjects(); |
81 bool hasPendingActivity(); | 82 bool hasPendingActivity(); |
82 | 83 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 150 |
150 private: | 151 private: |
151 friend class DOMTimer; // For installNewTimeout() and removeTimeoutByID() be
low. | 152 friend class DOMTimer; // For installNewTimeout() and removeTimeoutByID() be
low. |
152 | 153 |
153 virtual const KURL& virtualURL() const = 0; | 154 virtual const KURL& virtualURL() const = 0; |
154 virtual KURL virtualCompleteURL(const String&) const = 0; | 155 virtual KURL virtualCompleteURL(const String&) const = 0; |
155 | 156 |
156 virtual void addMessage(MessageSource, MessageLevel, const String& message,
const String& sourceURL, unsigned lineNumber, PassRefPtr<ScriptCallStack>, Scrip
tState* = 0, unsigned long requestIdentifier = 0) = 0; | 157 virtual void addMessage(MessageSource, MessageLevel, const String& message,
const String& sourceURL, unsigned lineNumber, PassRefPtr<ScriptCallStack>, Scrip
tState* = 0, unsigned long requestIdentifier = 0) = 0; |
157 virtual EventTarget* errorEventTarget() = 0; | 158 virtual EventTarget* errorEventTarget() = 0; |
158 virtual void logExceptionToConsole(const String& errorMessage, const String&
sourceURL, int lineNumber, int columnNumber, PassRefPtr<ScriptCallStack>) = 0; | 159 virtual void logExceptionToConsole(const String& errorMessage, const String&
sourceURL, int lineNumber, int columnNumber, PassRefPtr<ScriptCallStack>) = 0; |
159 bool dispatchErrorEvent(const String& errorMessage, int lineNumber, int colu
mnNumber, const String& sourceURL); | 160 bool dispatchErrorEvent(const String& errorMessage, int lineNumber, int colu
mnNumber, const String& sourceURL, ScriptAccessControlCheckStatus = ScriptIsNotS
haredCrossOrigin); |
160 | 161 |
161 void closeMessagePorts(); | 162 void closeMessagePorts(); |
162 | 163 |
163 virtual void refScriptExecutionContext() = 0; | 164 virtual void refScriptExecutionContext() = 0; |
164 virtual void derefScriptExecutionContext() = 0; | 165 virtual void derefScriptExecutionContext() = 0; |
165 virtual PassOwnPtr<LifecycleNotifier> createLifecycleNotifier() OVERRIDE; | 166 virtual PassOwnPtr<LifecycleNotifier> createLifecycleNotifier() OVERRIDE; |
166 | 167 |
167 // Implementation details for DOMTimer. No other classes should call these f
unctions. | 168 // Implementation details for DOMTimer. No other classes should call these f
unctions. |
168 int installNewTimeout(PassOwnPtr<ScheduledAction>, int timeout, bool singleS
hot); | 169 int installNewTimeout(PassOwnPtr<ScheduledAction>, int timeout, bool singleS
hot); |
169 void removeTimeoutByID(int timeoutID); // This makes underlying DOMTimer ins
tance destructed. | 170 void removeTimeoutByID(int timeoutID); // This makes underlying DOMTimer ins
tance destructed. |
(...skipping 18 matching lines...) Expand all Loading... |
188 | 189 |
189 // The location of this member is important; to make sure contextDestroyed()
notification on | 190 // The location of this member is important; to make sure contextDestroyed()
notification on |
190 // ScriptExecutionContext's members (notably m_timeouts) is called before th
ey are destructed, | 191 // ScriptExecutionContext's members (notably m_timeouts) is called before th
ey are destructed, |
191 // m_lifecycleNotifer should be placed *after* such members. | 192 // m_lifecycleNotifer should be placed *after* such members. |
192 OwnPtr<ContextLifecycleNotifier> m_lifecycleNotifier; | 193 OwnPtr<ContextLifecycleNotifier> m_lifecycleNotifier; |
193 }; | 194 }; |
194 | 195 |
195 } // namespace WebCore | 196 } // namespace WebCore |
196 | 197 |
197 #endif // ScriptExecutionContext_h | 198 #endif // ScriptExecutionContext_h |
OLD | NEW |