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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 // when a CSP is active, to see if implementing CSP | 489 // when a CSP is active, to see if implementing CSP |
490 // 'unsafe-redirect' is feasible. | 490 // 'unsafe-redirect' is feasible. |
491 if (csp && csp->isActive() && resourceRequest.frameType() != WebURLRequest::
FrameTypeTopLevel && resourceRequest.frameType() != WebURLRequest::FrameTypeAuxi
liary && redirectStatus == ContentSecurityPolicy::DidRedirect) { | 491 if (csp && csp->isActive() && resourceRequest.frameType() != WebURLRequest::
FrameTypeTopLevel && resourceRequest.frameType() != WebURLRequest::FrameTypeAuxi
liary && redirectStatus == ContentSecurityPolicy::DidRedirect) { |
492 ASSERT(frame()->document()); | 492 ASSERT(frame()->document()); |
493 UseCounter::count(frame()->document(), UseCounter::ResourceLoadedAfterRe
directWithCSP); | 493 UseCounter::count(frame()->document(), UseCounter::ResourceLoadedAfterRe
directWithCSP); |
494 } | 494 } |
495 | 495 |
496 // Last of all, check for mixed content. We do this last so that when | 496 // Last of all, check for mixed content. We do this last so that when |
497 // folks block mixed content with a CSP policy, they don't get a warning. | 497 // folks block mixed content with a CSP policy, they don't get a warning. |
498 // They'll still get a warning in the console about CSP blocking the load. | 498 // They'll still get a warning in the console about CSP blocking the load. |
499 | |
500 // If we're loading the main resource of a subframe, ensure that we check | |
501 // against the parent of the active frame, rather than the frame itself. | |
502 LocalFrame* effectiveFrame = frame(); | |
503 if (resourceRequest.frameType() == WebURLRequest::FrameTypeNested) { | |
504 // FIXME: Deal with RemoteFrames. | |
505 Frame* parentFrame = effectiveFrame->tree().parent(); | |
506 ASSERT(parentFrame); | |
507 if (parentFrame->isLocalFrame()) | |
508 effectiveFrame = toLocalFrame(parentFrame); | |
509 } | |
510 | |
511 MixedContentChecker::ReportingStatus mixedContentReporting = forPreload ? | 499 MixedContentChecker::ReportingStatus mixedContentReporting = forPreload ? |
512 MixedContentChecker::SuppressReport : MixedContentChecker::SendReport; | 500 MixedContentChecker::SuppressReport : MixedContentChecker::SendReport; |
513 return !MixedContentChecker::shouldBlockFetch(effectiveFrame, resourceReques
t, url, mixedContentReporting); | 501 return !MixedContentChecker::shouldBlockFetch(MixedContentChecker::effective
FrameForFrameType(frame(), resourceRequest.frameType()), resourceRequest, url, m
ixedContentReporting); |
514 } | 502 } |
515 | 503 |
516 bool FrameFetchContext::isControlledByServiceWorker() const | 504 bool FrameFetchContext::isControlledByServiceWorker() const |
517 { | 505 { |
518 ASSERT(m_documentLoader || frame()->loader().documentLoader()); | 506 ASSERT(m_documentLoader || frame()->loader().documentLoader()); |
519 if (m_documentLoader) | 507 if (m_documentLoader) |
520 return frame()->loader().client()->isControlledByServiceWorker(*m_docume
ntLoader); | 508 return frame()->loader().client()->isControlledByServiceWorker(*m_docume
ntLoader); |
521 // m_documentLoader is null while loading resources from an HTML import. | 509 // m_documentLoader is null while loading resources from an HTML import. |
522 // In such cases whether the request is controlled by ServiceWorker or not | 510 // In such cases whether the request is controlled by ServiceWorker or not |
523 // is determined by the document loader of the frame. | 511 // is determined by the document loader of the frame. |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 | 685 |
698 | 686 |
699 DEFINE_TRACE(FrameFetchContext) | 687 DEFINE_TRACE(FrameFetchContext) |
700 { | 688 { |
701 visitor->trace(m_document); | 689 visitor->trace(m_document); |
702 visitor->trace(m_documentLoader); | 690 visitor->trace(m_documentLoader); |
703 FetchContext::trace(visitor); | 691 FetchContext::trace(visitor); |
704 } | 692 } |
705 | 693 |
706 } // namespace blink | 694 } // namespace blink |
OLD | NEW |