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

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

Issue 625943002: Catch uncaught promise rejections from V8 and log to console. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: addressed Created 6 years, 2 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 namespace blink { 46 namespace blink {
47 47
48 class ContextLifecycleNotifier; 48 class ContextLifecycleNotifier;
49 class LocalDOMWindow; 49 class LocalDOMWindow;
50 class ErrorEvent; 50 class ErrorEvent;
51 class EventQueue; 51 class EventQueue;
52 class ExecutionContextTask; 52 class ExecutionContextTask;
53 class ScriptState; 53 class ScriptState;
54 class PublicURLManager; 54 class PublicURLManager;
55 class SecurityOrigin; 55 class SecurityOrigin;
56 class ScriptArguments;
56 class ScriptCallStack; 57 class ScriptCallStack;
57 58
58 class ExecutionContext 59 class ExecutionContext
59 : public LifecycleContext<ExecutionContext> 60 : public LifecycleContext<ExecutionContext>
60 , public WillBeHeapSupplementable<ExecutionContext> { 61 , public WillBeHeapSupplementable<ExecutionContext> {
61 public: 62 public:
62 virtual void trace(Visitor*) OVERRIDE; 63 virtual void trace(Visitor*) OVERRIDE;
63 64
64 virtual bool isDocument() const { return false; } 65 virtual bool isDocument() const { return false; }
65 virtual bool isWorkerGlobalScope() const { return false; } 66 virtual bool isWorkerGlobalScope() const { return false; }
(...skipping 12 matching lines...) Expand all
78 virtual void postTask(PassOwnPtr<ExecutionContextTask>) = 0; // Executes the task on context's thread asynchronously. 79 virtual void postTask(PassOwnPtr<ExecutionContextTask>) = 0; // Executes the task on context's thread asynchronously.
79 virtual double timerAlignmentInterval() const = 0; 80 virtual double timerAlignmentInterval() const = 0;
80 81
81 virtual void reportBlockedScriptExecutionToInspector(const String& directive Text) = 0; 82 virtual void reportBlockedScriptExecutionToInspector(const String& directive Text) = 0;
82 83
83 virtual SecurityContext& securityContext() = 0; 84 virtual SecurityContext& securityContext() = 0;
84 KURL contextURL() const { return virtualURL(); } 85 KURL contextURL() const { return virtualURL(); }
85 KURL contextCompleteURL(const String& url) const { return virtualCompleteURL (url); } 86 KURL contextCompleteURL(const String& url) const { return virtualCompleteURL (url); }
86 87
87 bool shouldSanitizeScriptError(const String& sourceURL, AccessControlStatus) ; 88 bool shouldSanitizeScriptError(const String& sourceURL, AccessControlStatus) ;
88 void reportException(PassRefPtrWillBeRawPtr<ErrorEvent>, int scriptId, PassR efPtrWillBeRawPtr<ScriptCallStack>, AccessControlStatus); 89 void reportException(PassRefPtrWillBeRawPtr<ErrorEvent>, int scriptId, PassR efPtrWillBeRawPtr<ScriptCallStack>, PassRefPtrWillBeRawPtr<ScriptArguments>, Acc essControlStatus, bool isPromiseReject = false);
89 90
90 virtual void addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage>) = 0; 91 virtual void addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage>) = 0;
91 virtual void logExceptionToConsole(const String& errorMessage, int scriptId, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawP tr<ScriptCallStack>) = 0; 92 virtual void logExceptionToConsole(const String& errorMessage, int scriptId, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawP tr<ScriptCallStack>, PassRefPtrWillBeRawPtr<ScriptArguments>) = 0;
92 93
93 PublicURLManager& publicURLManager(); 94 PublicURLManager& publicURLManager();
94 95
95 // Active objects are not garbage collected even if inaccessible, e.g. becau se their activity may result in callbacks being invoked. 96 // Active objects are not garbage collected even if inaccessible, e.g. becau se their activity may result in callbacks being invoked.
96 bool hasPendingActivity(); 97 bool hasPendingActivity();
97 98
98 void suspendActiveDOMObjects(); 99 void suspendActiveDOMObjects();
99 void resumeActiveDOMObjects(); 100 void resumeActiveDOMObjects();
100 void stopActiveDOMObjects(); 101 void stopActiveDOMObjects();
101 unsigned activeDOMObjectCount(); 102 unsigned activeDOMObjectCount();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 173
173 // The location of this member is important; to make sure contextDestroyed() notification on 174 // The location of this member is important; to make sure contextDestroyed() notification on
174 // ExecutionContext's members (notably m_timeouts) is called before they are destructed, 175 // ExecutionContext's members (notably m_timeouts) is called before they are destructed,
175 // m_lifecycleNotifer should be placed *after* such members. 176 // m_lifecycleNotifer should be placed *after* such members.
176 OwnPtr<ContextLifecycleNotifier> m_lifecycleNotifier; 177 OwnPtr<ContextLifecycleNotifier> m_lifecycleNotifier;
177 }; 178 };
178 179
179 } // namespace blink 180 } // namespace blink
180 181
181 #endif // ExecutionContext_h 182 #endif // ExecutionContext_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698