Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(494)

Side by Side Diff: Source/core/dom/ScriptExecutionContext.h

Issue 20351002: Add 'error' parameter to 'window.onerror' handlers. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Feedback. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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"
33 #include "core/dom/ErrorEvent.h"
32 #include "core/dom/SecurityContext.h" 34 #include "core/dom/SecurityContext.h"
33 #include "core/page/ConsoleTypes.h" 35 #include "core/page/ConsoleTypes.h"
34 #include "core/page/DOMTimer.h" 36 #include "core/page/DOMTimer.h"
35 #include "core/platform/LifecycleContext.h" 37 #include "core/platform/LifecycleContext.h"
36 #include "core/platform/Supplementable.h" 38 #include "core/platform/Supplementable.h"
37 #include "weborigin/KURL.h" 39 #include "weborigin/KURL.h"
38 #include "wtf/HashSet.h" 40 #include "wtf/HashSet.h"
39 #include "wtf/OwnPtr.h" 41 #include "wtf/OwnPtr.h"
40 #include "wtf/PassOwnPtr.h" 42 #include "wtf/PassOwnPtr.h"
41 43
(...skipping 19 matching lines...) Expand all
61 63
62 virtual bool isJSExecutionForbidden() const = 0; 64 virtual bool isJSExecutionForbidden() const = 0;
63 65
64 const KURL& url() const { return virtualURL(); } 66 const KURL& url() const { return virtualURL(); }
65 KURL completeURL(const String& url) const { return virtualCompleteURL(url); } 67 KURL completeURL(const String& url) const { return virtualCompleteURL(url); }
66 68
67 virtual String userAgent(const KURL&) const = 0; 69 virtual String userAgent(const KURL&) const = 0;
68 70
69 virtual void disableEval(const String& errorMessage) = 0; 71 virtual void disableEval(const String& errorMessage) = 0;
70 72
73 bool shouldSanitizeScriptError(const String& sourceURL);
71 bool sanitizeScriptError(String& errorMessage, int& lineNumber, int& columnN umber, String& sourceURL); 74 bool sanitizeScriptError(String& errorMessage, int& lineNumber, int& columnN umber, String& sourceURL);
72 void reportException(const String& errorMessage, int lineNumber, int columnN umber, const String& sourceURL, PassRefPtr<ScriptCallStack>); 75 void reportException(PassRefPtr<ErrorEvent>, PassRefPtr<ScriptCallStack>);
73 76
74 void addConsoleMessage(MessageSource, MessageLevel, const String& message, c onst String& sourceURL, unsigned lineNumber, ScriptState* = 0, unsigned long req uestIdentifier = 0); 77 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; 78 virtual void addConsoleMessage(MessageSource, MessageLevel, const String& me ssage, unsigned long requestIdentifier = 0) = 0;
76 79
77 PublicURLManager& publicURLManager(); 80 PublicURLManager& publicURLManager();
78 81
79 // Active objects are not garbage collected even if inaccessible, e.g. becau se their activity may result in callbacks being invoked. 82 // Active objects are not garbage collected even if inaccessible, e.g. becau se their activity may result in callbacks being invoked.
80 bool canSuspendActiveDOMObjects(); 83 bool canSuspendActiveDOMObjects();
81 bool hasPendingActivity(); 84 bool hasPendingActivity();
82 85
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 152
150 private: 153 private:
151 friend class DOMTimer; // For installNewTimeout() and removeTimeoutByID() be low. 154 friend class DOMTimer; // For installNewTimeout() and removeTimeoutByID() be low.
152 155
153 virtual const KURL& virtualURL() const = 0; 156 virtual const KURL& virtualURL() const = 0;
154 virtual KURL virtualCompleteURL(const String&) const = 0; 157 virtual KURL virtualCompleteURL(const String&) const = 0;
155 158
156 virtual void addMessage(MessageSource, MessageLevel, const String& message, const String& sourceURL, unsigned lineNumber, PassRefPtr<ScriptCallStack>, Scrip tState* = 0, unsigned long requestIdentifier = 0) = 0; 159 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; 160 virtual EventTarget* errorEventTarget() = 0;
158 virtual void logExceptionToConsole(const String& errorMessage, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtr<ScriptCallStack>) = 0; 161 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); 162 bool dispatchErrorEvent(PassRefPtr<ErrorEvent>);
160 163
161 void closeMessagePorts(); 164 void closeMessagePorts();
162 165
163 virtual void refScriptExecutionContext() = 0; 166 virtual void refScriptExecutionContext() = 0;
164 virtual void derefScriptExecutionContext() = 0; 167 virtual void derefScriptExecutionContext() = 0;
165 virtual PassOwnPtr<LifecycleNotifier> createLifecycleNotifier() OVERRIDE; 168 virtual PassOwnPtr<LifecycleNotifier> createLifecycleNotifier() OVERRIDE;
166 169
167 // Implementation details for DOMTimer. No other classes should call these f unctions. 170 // Implementation details for DOMTimer. No other classes should call these f unctions.
168 int installNewTimeout(PassOwnPtr<ScheduledAction>, int timeout, bool singleS hot); 171 int installNewTimeout(PassOwnPtr<ScheduledAction>, int timeout, bool singleS hot);
169 void removeTimeoutByID(int timeoutID); // This makes underlying DOMTimer ins tance destructed. 172 void removeTimeoutByID(int timeoutID); // This makes underlying DOMTimer ins tance destructed.
(...skipping 18 matching lines...) Expand all
188 191
189 // The location of this member is important; to make sure contextDestroyed() notification on 192 // 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, 193 // ScriptExecutionContext's members (notably m_timeouts) is called before th ey are destructed,
191 // m_lifecycleNotifer should be placed *after* such members. 194 // m_lifecycleNotifer should be placed *after* such members.
192 OwnPtr<ContextLifecycleNotifier> m_lifecycleNotifier; 195 OwnPtr<ContextLifecycleNotifier> m_lifecycleNotifier;
193 }; 196 };
194 197
195 } // namespace WebCore 198 } // namespace WebCore
196 199
197 #endif // ScriptExecutionContext_h 200 #endif // ScriptExecutionContext_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698