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

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: Constructor. 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
« no previous file with comments | « Source/core/dom/ErrorEvent.idl ('k') | Source/core/dom/ScriptExecutionContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 11 matching lines...) Expand all
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 "core/dom/ActiveDOMObject.h" 31 #include "core/dom/ActiveDOMObject.h"
32 #include "core/dom/ErrorEvent.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"
41 42
(...skipping 19 matching lines...) Expand all
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
72 bool shouldSanitizeScriptError(const String& sourceURL);
71 bool sanitizeScriptError(String& errorMessage, int& lineNumber, int& columnN umber, String& sourceURL); 73 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>); 74 void reportException(PassRefPtr<ErrorEvent>, PassRefPtr<ScriptCallStack>);
73 75
74 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);
75 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;
76 78
77 PublicURLManager& publicURLManager(); 79 PublicURLManager& publicURLManager();
78 80
79 // 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.
80 bool canSuspendActiveDOMObjects(); 82 bool canSuspendActiveDOMObjects();
81 bool hasPendingActivity(); 83 bool hasPendingActivity();
82 84
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 151
150 private: 152 private:
151 friend class DOMTimer; // For installNewTimeout() and removeTimeoutByID() be low. 153 friend class DOMTimer; // For installNewTimeout() and removeTimeoutByID() be low.
152 154
153 virtual const KURL& virtualURL() const = 0; 155 virtual const KURL& virtualURL() const = 0;
154 virtual KURL virtualCompleteURL(const String&) const = 0; 156 virtual KURL virtualCompleteURL(const String&) const = 0;
155 157
156 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;
157 virtual EventTarget* errorEventTarget() = 0; 159 virtual EventTarget* errorEventTarget() = 0;
158 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;
159 bool dispatchErrorEvent(const String& errorMessage, int lineNumber, int colu mnNumber, const String& sourceURL); 161 bool dispatchErrorEvent(PassRefPtr<ErrorEvent>);
160 162
161 void closeMessagePorts(); 163 void closeMessagePorts();
162 164
163 virtual void refScriptExecutionContext() = 0; 165 virtual void refScriptExecutionContext() = 0;
164 virtual void derefScriptExecutionContext() = 0; 166 virtual void derefScriptExecutionContext() = 0;
165 virtual PassOwnPtr<LifecycleNotifier> createLifecycleNotifier() OVERRIDE; 167 virtual PassOwnPtr<LifecycleNotifier> createLifecycleNotifier() OVERRIDE;
166 168
167 // 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.
168 int installNewTimeout(PassOwnPtr<ScheduledAction>, int timeout, bool singleS hot); 170 int installNewTimeout(PassOwnPtr<ScheduledAction>, int timeout, bool singleS hot);
169 void removeTimeoutByID(int timeoutID); // This makes underlying DOMTimer ins tance destructed. 171 void removeTimeoutByID(int timeoutID); // This makes underlying DOMTimer ins tance destructed.
(...skipping 18 matching lines...) Expand all
188 190
189 // 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
190 // 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,
191 // m_lifecycleNotifer should be placed *after* such members. 193 // m_lifecycleNotifer should be placed *after* such members.
192 OwnPtr<ContextLifecycleNotifier> m_lifecycleNotifier; 194 OwnPtr<ContextLifecycleNotifier> m_lifecycleNotifier;
193 }; 195 };
194 196
195 } // namespace WebCore 197 } // namespace WebCore
196 198
197 #endif // ScriptExecutionContext_h 199 #endif // ScriptExecutionContext_h
OLDNEW
« no previous file with comments | « Source/core/dom/ErrorEvent.idl ('k') | Source/core/dom/ScriptExecutionContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698