OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 } | 199 } |
200 return memoryCachePolicyToResourceRequestCachePolicy(cachePolicy()); | 200 return memoryCachePolicyToResourceRequestCachePolicy(cachePolicy()); |
201 } | 201 } |
202 return UseProtocolCachePolicy; | 202 return UseProtocolCachePolicy; |
203 } | 203 } |
204 | 204 |
205 // FIXME(http://crbug.com/274173): | 205 // FIXME(http://crbug.com/274173): |
206 // |loader| can be null if the resource is loaded from imported document. | 206 // |loader| can be null if the resource is loaded from imported document. |
207 // This means inspector, which uses DocumentLoader as an grouping entity, | 207 // This means inspector, which uses DocumentLoader as an grouping entity, |
208 // cannot see imported documents. | 208 // cannot see imported documents. |
209 inline DocumentLoader* FrameFetchContext::ensureLoaderForNotifications() | 209 inline DocumentLoader* FrameFetchContext::ensureLoaderForNotifications() const |
210 { | 210 { |
211 return m_documentLoader ? m_documentLoader.get() : frame()->loader().documen
tLoader(); | 211 return m_documentLoader ? m_documentLoader.get() : frame()->loader().documen
tLoader(); |
212 } | 212 } |
213 | 213 |
214 void FrameFetchContext::dispatchDidChangeResourcePriority(unsigned long identifi
er, ResourceLoadPriority loadPriority, int intraPriorityValue) | 214 void FrameFetchContext::dispatchDidChangeResourcePriority(unsigned long identifi
er, ResourceLoadPriority loadPriority, int intraPriorityValue) |
215 { | 215 { |
216 frame()->loader().client()->dispatchDidChangeResourcePriority(identifier, lo
adPriority, intraPriorityValue); | 216 frame()->loader().client()->dispatchDidChangeResourcePriority(identifier, lo
adPriority, intraPriorityValue); |
217 } | 217 } |
218 | 218 |
219 void FrameFetchContext::dispatchWillSendRequest(unsigned long identifier, Resour
ceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiat
orInfo& initiatorInfo) | 219 void FrameFetchContext::dispatchWillSendRequest(unsigned long identifier, Resour
ceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiat
orInfo& initiatorInfo) |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 else | 342 else |
343 message = "Unsafe attempt to load URL " + url.elidedString() + " from fr
ame with URL " + m_document->url().elidedString() + ". Domains, protocols and po
rts must match.\n"; | 343 message = "Unsafe attempt to load URL " + url.elidedString() + " from fr
ame with URL " + m_document->url().elidedString() + ". Domains, protocols and po
rts must match.\n"; |
344 | 344 |
345 frame()->document()->addConsoleMessage(ConsoleMessage::create(SecurityMessag
eSource, ErrorMessageLevel, message)); | 345 frame()->document()->addConsoleMessage(ConsoleMessage::create(SecurityMessag
eSource, ErrorMessageLevel, message)); |
346 } | 346 } |
347 | 347 |
348 bool FrameFetchContext::canRequest(Resource::Type type, const ResourceRequest& r
esourceRequest, const KURL& url, const ResourceLoaderOptions& options, bool forP
reload, FetchRequest::OriginRestriction originRestriction) const | 348 bool FrameFetchContext::canRequest(Resource::Type type, const ResourceRequest& r
esourceRequest, const KURL& url, const ResourceLoaderOptions& options, bool forP
reload, FetchRequest::OriginRestriction originRestriction) const |
349 { | 349 { |
350 InstrumentingAgents* agents = InspectorInstrumentation::instrumentingAgentsF
or(frame()); | 350 InstrumentingAgents* agents = InspectorInstrumentation::instrumentingAgentsF
or(frame()); |
351 if (agents && agents->inspectorResourceAgent()) { | 351 if (agents && agents->inspectorResourceAgent()) { |
352 if (agents->inspectorResourceAgent()->shouldBlockRequest(resourceRequest
)) | 352 if (agents->inspectorResourceAgent()->shouldBlockRequest(frame(), resour
ceRequest, ensureLoaderForNotifications(), options.initiatorInfo)) |
353 return false; | 353 return false; |
354 } | 354 } |
355 | 355 |
356 SecurityOrigin* securityOrigin = options.securityOrigin.get(); | 356 SecurityOrigin* securityOrigin = options.securityOrigin.get(); |
357 if (!securityOrigin && m_document) | 357 if (!securityOrigin && m_document) |
358 securityOrigin = m_document->securityOrigin(); | 358 securityOrigin = m_document->securityOrigin(); |
359 | 359 |
360 if (originRestriction != FetchRequest::NoOriginRestriction && securityOrigin
&& !securityOrigin->canDisplay(url)) { | 360 if (originRestriction != FetchRequest::NoOriginRestriction && securityOrigin
&& !securityOrigin->canDisplay(url)) { |
361 if (!forPreload) | 361 if (!forPreload) |
362 FrameLoader::reportLocalLoadFailed(frame(), url.elidedString()); | 362 FrameLoader::reportLocalLoadFailed(frame(), url.elidedString()); |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 | 685 |
686 | 686 |
687 DEFINE_TRACE(FrameFetchContext) | 687 DEFINE_TRACE(FrameFetchContext) |
688 { | 688 { |
689 visitor->trace(m_document); | 689 visitor->trace(m_document); |
690 visitor->trace(m_documentLoader); | 690 visitor->trace(m_documentLoader); |
691 FetchContext::trace(visitor); | 691 FetchContext::trace(visitor); |
692 } | 692 } |
693 | 693 |
694 } // namespace blink | 694 } // namespace blink |
OLD | NEW |