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

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

Issue 19596004: Allow sites to enable 'window.onerror' handlers for cross-domain scripts. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase. 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 13 matching lines...) Expand all
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/ErrorEvent.h"
33 #include "core/dom/SecurityContext.h" 33 #include "core/dom/SecurityContext.h"
34 #include "core/loader/CrossOriginAccessControl.h"
34 #include "core/page/ConsoleTypes.h" 35 #include "core/page/ConsoleTypes.h"
35 #include "core/page/DOMTimer.h" 36 #include "core/page/DOMTimer.h"
36 #include "core/platform/LifecycleContext.h" 37 #include "core/platform/LifecycleContext.h"
37 #include "core/platform/Supplementable.h" 38 #include "core/platform/Supplementable.h"
38 #include "weborigin/KURL.h" 39 #include "weborigin/KURL.h"
39 #include "wtf/HashSet.h" 40 #include "wtf/HashSet.h"
40 #include "wtf/OwnPtr.h" 41 #include "wtf/OwnPtr.h"
41 #include "wtf/PassOwnPtr.h" 42 #include "wtf/PassOwnPtr.h"
42 43
43 namespace WebCore { 44 namespace WebCore {
(...skipping 18 matching lines...) Expand all
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 shouldSanitizeScriptError(const String& sourceURL); 73 bool shouldSanitizeScriptError(const String& sourceURL, AccessControlStatus) ;
73 bool sanitizeScriptError(String& errorMessage, int& lineNumber, int& columnN umber, String& sourceURL); 74 void reportException(PassRefPtr<ErrorEvent>, PassRefPtr<ScriptCallStack>, Ac cessControlStatus);
74 void reportException(PassRefPtr<ErrorEvent>, PassRefPtr<ScriptCallStack>);
75 75
76 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);
77 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;
78 78
79 PublicURLManager& publicURLManager(); 79 PublicURLManager& publicURLManager();
80 80
81 // 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.
82 bool canSuspendActiveDOMObjects(); 82 bool canSuspendActiveDOMObjects();
83 bool hasPendingActivity(); 83 bool hasPendingActivity();
84 84
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 private: 152 private:
153 friend class DOMTimer; // For installNewTimeout() and removeTimeoutByID() be low. 153 friend class DOMTimer; // For installNewTimeout() and removeTimeoutByID() be low.
154 154
155 virtual const KURL& virtualURL() const = 0; 155 virtual const KURL& virtualURL() const = 0;
156 virtual KURL virtualCompleteURL(const String&) const = 0; 156 virtual KURL virtualCompleteURL(const String&) const = 0;
157 157
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 void addMessage(MessageSource, MessageLevel, const String& message, const String& sourceURL, unsigned lineNumber, PassRefPtr<ScriptCallStack>, Scrip tState* = 0, unsigned long requestIdentifier = 0) = 0;
159 virtual EventTarget* errorEventTarget() = 0; 159 virtual EventTarget* errorEventTarget() = 0;
160 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;
161 bool dispatchErrorEvent(PassRefPtr<ErrorEvent>); 161 bool dispatchErrorEvent(PassRefPtr<ErrorEvent>, AccessControlStatus);
162 162
163 void closeMessagePorts(); 163 void closeMessagePorts();
164 164
165 virtual void refScriptExecutionContext() = 0; 165 virtual void refScriptExecutionContext() = 0;
166 virtual void derefScriptExecutionContext() = 0; 166 virtual void derefScriptExecutionContext() = 0;
167 virtual PassOwnPtr<LifecycleNotifier> createLifecycleNotifier() OVERRIDE; 167 virtual PassOwnPtr<LifecycleNotifier> createLifecycleNotifier() OVERRIDE;
168 168
169 // 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.
170 int installNewTimeout(PassOwnPtr<ScheduledAction>, int timeout, bool singleS hot); 170 int installNewTimeout(PassOwnPtr<ScheduledAction>, int timeout, bool singleS hot);
171 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
190 190
191 // 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
192 // 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,
193 // m_lifecycleNotifer should be placed *after* such members. 193 // m_lifecycleNotifer should be placed *after* such members.
194 OwnPtr<ContextLifecycleNotifier> m_lifecycleNotifier; 194 OwnPtr<ContextLifecycleNotifier> m_lifecycleNotifier;
195 }; 195 };
196 196
197 } // namespace WebCore 197 } // namespace WebCore
198 198
199 #endif // ScriptExecutionContext_h 199 #endif // ScriptExecutionContext_h
OLDNEW
« no previous file with comments | « Source/bindings/v8/WorkerScriptController.cpp ('k') | Source/core/dom/ScriptExecutionContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698