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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 object->suspend(); 138 object->suspend();
139 } 139 }
140 140
141 bool ExecutionContext::shouldSanitizeScriptError(const String& sourceURL, Access ControlStatus corsStatus) 141 bool ExecutionContext::shouldSanitizeScriptError(const String& sourceURL, Access ControlStatus corsStatus)
142 { 142 {
143 if (corsStatus == OpaqueResource) 143 if (corsStatus == OpaqueResource)
144 return true; 144 return true;
145 return !(getSecurityOrigin()->canRequestNoSuborigin(completeURL(sourceURL)) || corsStatus == SharableCrossOrigin); 145 return !(getSecurityOrigin()->canRequestNoSuborigin(completeURL(sourceURL)) || corsStatus == SharableCrossOrigin);
146 } 146 }
147 147
148 void ExecutionContext::reportException(PassRefPtrWillBeRawPtr<ErrorEvent> event, int scriptId, PassRefPtr<ScriptCallStack> callStack, AccessControlStatus corsSt atus) 148 void ExecutionContext::reportException(RawPtr<ErrorEvent> event, int scriptId, P assRefPtr<ScriptCallStack> callStack, AccessControlStatus corsStatus)
149 { 149 {
150 RefPtrWillBeRawPtr<ErrorEvent> errorEvent = event; 150 RawPtr<ErrorEvent> errorEvent = event;
151 if (m_inDispatchErrorEvent) { 151 if (m_inDispatchErrorEvent) {
152 if (!m_pendingExceptions) 152 if (!m_pendingExceptions)
153 m_pendingExceptions = adoptPtr(new Vector<OwnPtr<PendingException>>( )); 153 m_pendingExceptions = adoptPtr(new Vector<OwnPtr<PendingException>>( ));
154 m_pendingExceptions->append(adoptPtr(new PendingException(errorEvent->me ssageForConsole(), errorEvent->lineno(), errorEvent->colno(), scriptId, errorEve nt->filename(), callStack))); 154 m_pendingExceptions->append(adoptPtr(new PendingException(errorEvent->me ssageForConsole(), errorEvent->lineno(), errorEvent->colno(), scriptId, errorEve nt->filename(), callStack)));
155 return; 155 return;
156 } 156 }
157 157
158 // First report the original exception and only then all the nested ones. 158 // First report the original exception and only then all the nested ones.
159 if (!dispatchErrorEvent(errorEvent, corsStatus)) 159 if (!dispatchErrorEvent(errorEvent, corsStatus))
160 logExceptionToConsole(errorEvent->messageForConsole(), scriptId, errorEv ent->filename(), errorEvent->lineno(), errorEvent->colno(), callStack); 160 logExceptionToConsole(errorEvent->messageForConsole(), scriptId, errorEv ent->filename(), errorEvent->lineno(), errorEvent->colno(), callStack);
161 161
162 if (!m_pendingExceptions) 162 if (!m_pendingExceptions)
163 return; 163 return;
164 164
165 for (size_t i = 0; i < m_pendingExceptions->size(); i++) { 165 for (size_t i = 0; i < m_pendingExceptions->size(); i++) {
166 PendingException* e = m_pendingExceptions->at(i).get(); 166 PendingException* e = m_pendingExceptions->at(i).get();
167 logExceptionToConsole(e->m_errorMessage, e->m_scriptId, e->m_sourceURL, e->m_lineNumber, e->m_columnNumber, e->m_callStack); 167 logExceptionToConsole(e->m_errorMessage, e->m_scriptId, e->m_sourceURL, e->m_lineNumber, e->m_columnNumber, e->m_callStack);
168 } 168 }
169 m_pendingExceptions.clear(); 169 m_pendingExceptions.clear();
170 } 170 }
171 171
172 bool ExecutionContext::dispatchErrorEvent(PassRefPtrWillBeRawPtr<ErrorEvent> eve nt, AccessControlStatus corsStatus) 172 bool ExecutionContext::dispatchErrorEvent(RawPtr<ErrorEvent> event, AccessContro lStatus corsStatus)
173 { 173 {
174 EventTarget* target = errorEventTarget(); 174 EventTarget* target = errorEventTarget();
175 if (!target) 175 if (!target)
176 return false; 176 return false;
177 177
178 RefPtrWillBeRawPtr<ErrorEvent> errorEvent = event; 178 RawPtr<ErrorEvent> errorEvent = event;
179 if (shouldSanitizeScriptError(errorEvent->filename(), corsStatus)) 179 if (shouldSanitizeScriptError(errorEvent->filename(), corsStatus))
180 errorEvent = ErrorEvent::createSanitizedError(errorEvent->world()); 180 errorEvent = ErrorEvent::createSanitizedError(errorEvent->world());
181 181
182 ASSERT(!m_inDispatchErrorEvent); 182 ASSERT(!m_inDispatchErrorEvent);
183 m_inDispatchErrorEvent = true; 183 m_inDispatchErrorEvent = true;
184 target->dispatchEvent(errorEvent); 184 target->dispatchEvent(errorEvent);
185 m_inDispatchErrorEvent = false; 185 m_inDispatchErrorEvent = false;
186 return errorEvent->defaultPrevented(); 186 return errorEvent->defaultPrevented();
187 } 187 }
188 188
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 void ExecutionContext::setReferrerPolicy(ReferrerPolicy referrerPolicy) 257 void ExecutionContext::setReferrerPolicy(ReferrerPolicy referrerPolicy)
258 { 258 {
259 // When a referrer policy has already been set, the latest value takes prece dence. 259 // When a referrer policy has already been set, the latest value takes prece dence.
260 UseCounter::count(this, UseCounter::SetReferrerPolicy); 260 UseCounter::count(this, UseCounter::SetReferrerPolicy);
261 if (m_referrerPolicy != ReferrerPolicyDefault) 261 if (m_referrerPolicy != ReferrerPolicyDefault)
262 UseCounter::count(this, UseCounter::ResetReferrerPolicy); 262 UseCounter::count(this, UseCounter::ResetReferrerPolicy);
263 263
264 m_referrerPolicy = referrerPolicy; 264 m_referrerPolicy = referrerPolicy;
265 } 265 }
266 266
267 PassOwnPtrWillBeRawPtr<OriginTrialContext> ExecutionContext::createOriginTrialCo ntext() 267 RawPtr<OriginTrialContext> ExecutionContext::createOriginTrialContext()
268 { 268 {
269 return nullptr; 269 return nullptr;
270 } 270 }
271 271
272 void ExecutionContext::removeURLFromMemoryCache(const KURL& url) 272 void ExecutionContext::removeURLFromMemoryCache(const KURL& url)
273 { 273 {
274 memoryCache()->removeURLFromCache(url); 274 memoryCache()->removeURLFromCache(url);
275 } 275 }
276 276
277 DEFINE_TRACE(ExecutionContext) 277 DEFINE_TRACE(ExecutionContext)
278 { 278 {
279 #if ENABLE(OILPAN) 279 #if ENABLE(OILPAN)
280 visitor->trace(m_publicURLManager); 280 visitor->trace(m_publicURLManager);
281 HeapSupplementable<ExecutionContext>::trace(visitor); 281 HeapSupplementable<ExecutionContext>::trace(visitor);
282 #endif 282 #endif
283 ContextLifecycleNotifier::trace(visitor); 283 ContextLifecycleNotifier::trace(visitor);
284 } 284 }
285 285
286 } // namespace blink 286 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ExecutionContext.h ('k') | third_party/WebKit/Source/core/dom/FirstLetterPseudoElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698