| 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 10 matching lines...) Expand all Loading... |
| 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 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 "bindings/v8/ScriptValue.h" |
| 31 #include "core/dom/ActiveDOMObject.h" | 32 #include "core/dom/ActiveDOMObject.h" |
| 32 #include "core/dom/SecurityContext.h" | 33 #include "core/dom/SecurityContext.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" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 62 | 63 |
| 63 virtual bool isJSExecutionForbidden() const = 0; | 64 virtual bool isJSExecutionForbidden() const = 0; |
| 64 | 65 |
| 65 const KURL& url() const { return virtualURL(); } | 66 const KURL& url() const { return virtualURL(); } |
| 66 KURL completeURL(const String& url) const { return virtualCompleteURL(url);
} | 67 KURL completeURL(const String& url) const { return virtualCompleteURL(url);
} |
| 67 | 68 |
| 68 virtual String userAgent(const KURL&) const = 0; | 69 virtual String userAgent(const KURL&) const = 0; |
| 69 | 70 |
| 70 virtual void disableEval(const String& errorMessage) = 0; | 71 virtual void disableEval(const String& errorMessage) = 0; |
| 71 | 72 |
| 72 bool sanitizeScriptError(String& errorMessage, int& lineNumber, int& columnN
umber, String& sourceURL, CachedScript* = 0); | 73 bool sanitizeScriptError(String& errorMessage, int& lineNumber, int& columnN
umber, String& sourceURL, ScriptValue&, CachedScript* = 0); |
| 73 void reportException(const String& errorMessage, int lineNumber, int columnN
umber, const String& sourceURL, PassRefPtr<ScriptCallStack>, CachedScript* = 0); | 74 void reportException(const String& errorMessage, int lineNumber, int columnN
umber, const String& sourceURL, PassRefPtr<ScriptCallStack>, const ScriptValue&
= ScriptValue(), CachedScript* = 0); |
| 74 | 75 |
| 75 void addConsoleMessage(MessageSource, MessageLevel, const String& message, c
onst String& sourceURL, unsigned lineNumber, ScriptState* = 0, unsigned long req
uestIdentifier = 0); | 76 void addConsoleMessage(MessageSource, MessageLevel, const String& message, c
onst String& sourceURL, unsigned lineNumber, ScriptState* = 0, unsigned long req
uestIdentifier = 0); |
| 76 virtual void addConsoleMessage(MessageSource, MessageLevel, const String& me
ssage, unsigned long requestIdentifier = 0) = 0; | 77 virtual void addConsoleMessage(MessageSource, MessageLevel, const String& me
ssage, unsigned long requestIdentifier = 0) = 0; |
| 77 | 78 |
| 78 PublicURLManager& publicURLManager(); | 79 PublicURLManager& publicURLManager(); |
| 79 | 80 |
| 80 // Active objects are not garbage collected even if inaccessible, e.g. becau
se their activity may result in callbacks being invoked. | 81 // Active objects are not garbage collected even if inaccessible, e.g. becau
se their activity may result in callbacks being invoked. |
| 81 bool canSuspendActiveDOMObjects(); | 82 bool canSuspendActiveDOMObjects(); |
| 82 bool hasPendingActivity(); | 83 bool hasPendingActivity(); |
| 83 | 84 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 151 |
| 151 private: | 152 private: |
| 152 friend class DOMTimer; // For installNewTimeout() and removeTimeoutByID() be
low. | 153 friend class DOMTimer; // For installNewTimeout() and removeTimeoutByID() be
low. |
| 153 | 154 |
| 154 virtual const KURL& virtualURL() const = 0; | 155 virtual const KURL& virtualURL() const = 0; |
| 155 virtual KURL virtualCompleteURL(const String&) const = 0; | 156 virtual KURL virtualCompleteURL(const String&) const = 0; |
| 156 | 157 |
| 157 virtual void addMessage(MessageSource, MessageLevel, const String& message,
const String& sourceURL, unsigned lineNumber, PassRefPtr<ScriptCallStack>, Scrip
tState* = 0, unsigned long requestIdentifier = 0) = 0; | 158 virtual void addMessage(MessageSource, MessageLevel, const String& message,
const String& sourceURL, unsigned lineNumber, PassRefPtr<ScriptCallStack>, Scrip
tState* = 0, unsigned long requestIdentifier = 0) = 0; |
| 158 virtual EventTarget* errorEventTarget() = 0; | 159 virtual EventTarget* errorEventTarget() = 0; |
| 159 virtual void logExceptionToConsole(const String& errorMessage, const String&
sourceURL, int lineNumber, int columnNumber, PassRefPtr<ScriptCallStack>) = 0; | 160 virtual void logExceptionToConsole(const String& errorMessage, const String&
sourceURL, int lineNumber, int columnNumber, PassRefPtr<ScriptCallStack>) = 0; |
| 160 bool dispatchErrorEvent(const String& errorMessage, int lineNumber, int colu
mnNumber, const String& sourceURL, CachedScript*); | 161 bool dispatchErrorEvent(const String& errorMessage, int lineNumber, int colu
mnNumber, const String& sourceURL, const ScriptValue&, CachedScript*); |
| 161 | 162 |
| 162 void closeMessagePorts(); | 163 void closeMessagePorts(); |
| 163 | 164 |
| 164 virtual void refScriptExecutionContext() = 0; | 165 virtual void refScriptExecutionContext() = 0; |
| 165 virtual void derefScriptExecutionContext() = 0; | 166 virtual void derefScriptExecutionContext() = 0; |
| 166 virtual PassOwnPtr<LifecycleNotifier> createLifecycleNotifier() OVERRIDE; | 167 virtual PassOwnPtr<LifecycleNotifier> createLifecycleNotifier() OVERRIDE; |
| 167 | 168 |
| 168 // Implementation details for DOMTimer. No other classes should call these f
unctions. | 169 // Implementation details for DOMTimer. No other classes should call these f
unctions. |
| 169 int installNewTimeout(DOMTimer::Type, PassOwnPtr<ScheduledAction>, int timeo
ut); | 170 int installNewTimeout(DOMTimer::Type, PassOwnPtr<ScheduledAction>, int timeo
ut); |
| 170 bool removeTimeoutByIDIfTypeMatches(DOMTimer::Type, int timeoutID); // This
makes underlying DOMTimer instance destructed. Returns true if removed. | 171 bool removeTimeoutByIDIfTypeMatches(DOMTimer::Type, int timeoutID); // This
makes underlying DOMTimer instance destructed. Returns true if removed. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 189 | 190 |
| 190 // The location of this member is important; to make sure contextDestroyed()
notification on | 191 // The location of this member is important; to make sure contextDestroyed()
notification on |
| 191 // ScriptExecutionContext's members (notably m_timeouts) is called before th
ey are destructed, | 192 // ScriptExecutionContext's members (notably m_timeouts) is called before th
ey are destructed, |
| 192 // m_lifecycleNotifer should be placed *after* such members. | 193 // m_lifecycleNotifer should be placed *after* such members. |
| 193 OwnPtr<ContextLifecycleNotifier> m_lifecycleNotifier; | 194 OwnPtr<ContextLifecycleNotifier> m_lifecycleNotifier; |
| 194 }; | 195 }; |
| 195 | 196 |
| 196 } // namespace WebCore | 197 } // namespace WebCore |
| 197 | 198 |
| 198 #endif // ScriptExecutionContext_h | 199 #endif // ScriptExecutionContext_h |
| OLD | NEW |