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

Side by Side Diff: third_party/WebKit/Source/core/dom/ExecutionContext.cpp

Issue 2006893004: Store SourceLocation in ErrorEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2010603002
Patch Set: rebased Created 4 years, 6 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
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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 object->suspend(); 131 object->suspend();
132 } 132 }
133 133
134 bool ExecutionContext::shouldSanitizeScriptError(const String& sourceURL, Access ControlStatus corsStatus) 134 bool ExecutionContext::shouldSanitizeScriptError(const String& sourceURL, Access ControlStatus corsStatus)
135 { 135 {
136 if (corsStatus == OpaqueResource) 136 if (corsStatus == OpaqueResource)
137 return true; 137 return true;
138 return !(getSecurityOrigin()->canRequestNoSuborigin(completeURL(sourceURL)) || corsStatus == SharableCrossOrigin); 138 return !(getSecurityOrigin()->canRequestNoSuborigin(completeURL(sourceURL)) || corsStatus == SharableCrossOrigin);
139 } 139 }
140 140
141 void ExecutionContext::reportException(ErrorEvent* errorEvent, PassOwnPtr<Source Location> location, AccessControlStatus corsStatus) 141 void ExecutionContext::reportException(ErrorEvent* errorEvent, AccessControlStat us corsStatus)
142 { 142 {
143 if (m_inDispatchErrorEvent) { 143 if (m_inDispatchErrorEvent) {
144 if (!m_pendingExceptions) 144 if (!m_pendingExceptions)
145 m_pendingExceptions = adoptPtr(new Vector<OwnPtr<PendingException>>( )); 145 m_pendingExceptions = adoptPtr(new Vector<OwnPtr<PendingException>>( ));
146 m_pendingExceptions->append(adoptPtr(new PendingException(errorEvent->me ssageForConsole(), std::move(location)))); 146 m_pendingExceptions->append(adoptPtr(new PendingException(errorEvent->me ssageForConsole(), errorEvent->location()->clone())));
147 return; 147 return;
148 } 148 }
149 149
150 // First report the original exception and only then all the nested ones. 150 // First report the original exception and only then all the nested ones.
151 if (!dispatchErrorEvent(errorEvent, corsStatus)) 151 if (!dispatchErrorEvent(errorEvent, corsStatus))
152 logExceptionToConsole(errorEvent->messageForConsole(), std::move(locatio n)); 152 logExceptionToConsole(errorEvent->messageForConsole(), errorEvent->locat ion()->clone());
153 153
154 if (!m_pendingExceptions) 154 if (!m_pendingExceptions)
155 return; 155 return;
156 156
157 for (size_t i = 0; i < m_pendingExceptions->size(); i++) { 157 for (size_t i = 0; i < m_pendingExceptions->size(); i++) {
158 PendingException* e = m_pendingExceptions->at(i).get(); 158 PendingException* e = m_pendingExceptions->at(i).get();
159 logExceptionToConsole(e->m_errorMessage, std::move(e->m_location)); 159 logExceptionToConsole(e->m_errorMessage, std::move(e->m_location));
160 } 160 }
161 m_pendingExceptions.reset(); 161 m_pendingExceptions.reset();
162 } 162 }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 } 266 }
267 267
268 DEFINE_TRACE(ExecutionContext) 268 DEFINE_TRACE(ExecutionContext)
269 { 269 {
270 visitor->trace(m_publicURLManager); 270 visitor->trace(m_publicURLManager);
271 ContextLifecycleNotifier::trace(visitor); 271 ContextLifecycleNotifier::trace(visitor);
272 Supplementable<ExecutionContext>::trace(visitor); 272 Supplementable<ExecutionContext>::trace(visitor);
273 } 273 }
274 274
275 } // namespace blink 275 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698