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

Side by Side Diff: Source/core/loader/FrameFetchContext.cpp

Issue 1299493003: Attach mixed content status to resource requests when sent to devtools (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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) 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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 if (!m_document || m_document->url().isNull()) 339 if (!m_document || m_document->url().isNull())
340 message = "Unsafe attempt to load URL " + url.elidedString() + '.'; 340 message = "Unsafe attempt to load URL " + url.elidedString() + '.';
341 else if (url.isLocalFile() || m_document->url().isLocalFile()) 341 else if (url.isLocalFile() || m_document->url().isLocalFile())
342 message = "Unsafe attempt to load URL " + url.elidedString() + " from fr ame with URL " + m_document->url().elidedString() + ". 'file:' URLs are treated as unique security origins.\n"; 342 message = "Unsafe attempt to load URL " + url.elidedString() + " from fr ame with URL " + m_document->url().elidedString() + ". 'file:' URLs are treated as unique security origins.\n";
343 else 343 else
344 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 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";
345 345
346 frame()->document()->addConsoleMessage(ConsoleMessage::create(SecurityMessag eSource, ErrorMessageLevel, message)); 346 frame()->document()->addConsoleMessage(ConsoleMessage::create(SecurityMessag eSource, ErrorMessageLevel, message));
347 } 347 }
348 348
349 bool FrameFetchContext::canRequest(Resource::Type type, const ResourceRequest& r esourceRequest, const KURL& url, const ResourceLoaderOptions& options, bool forP reload, FetchRequest::OriginRestriction originRestriction) const 349 bool FrameFetchContext::canRequest(Resource::Type type, ResourceRequest& resourc eRequest, const KURL& url, const ResourceLoaderOptions& options, bool forPreload , FetchRequest::OriginRestriction originRestriction) const
350 { 350 {
351 SecurityOrigin* securityOrigin = options.securityOrigin.get(); 351 SecurityOrigin* securityOrigin = options.securityOrigin.get();
352 if (!securityOrigin && m_document) 352 if (!securityOrigin && m_document)
353 securityOrigin = m_document->securityOrigin(); 353 securityOrigin = m_document->securityOrigin();
354 354
355 if (originRestriction != FetchRequest::NoOriginRestriction && securityOrigin && !securityOrigin->canDisplay(url)) { 355 if (originRestriction != FetchRequest::NoOriginRestriction && securityOrigin && !securityOrigin->canDisplay(url)) {
356 if (!forPreload) 356 if (!forPreload)
357 FrameLoader::reportLocalLoadFailed(frame(), url.elidedString()); 357 FrameLoader::reportLocalLoadFailed(frame(), url.elidedString());
358 WTF_LOG(ResourceLoading, "ResourceFetcher::requestResource URL was not a llowed by SecurityOrigin::canDisplay"); 358 WTF_LOG(ResourceLoading, "ResourceFetcher::requestResource URL was not a llowed by SecurityOrigin::canDisplay");
359 return false; 359 return false;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 if (resourceRequest.frameType() == WebURLRequest::FrameTypeNested) { 503 if (resourceRequest.frameType() == WebURLRequest::FrameTypeNested) {
504 // FIXME: Deal with RemoteFrames. 504 // FIXME: Deal with RemoteFrames.
505 Frame* parentFrame = effectiveFrame->tree().parent(); 505 Frame* parentFrame = effectiveFrame->tree().parent();
506 ASSERT(parentFrame); 506 ASSERT(parentFrame);
507 if (parentFrame->isLocalFrame()) 507 if (parentFrame->isLocalFrame())
508 effectiveFrame = toLocalFrame(parentFrame); 508 effectiveFrame = toLocalFrame(parentFrame);
509 } 509 }
510 510
511 MixedContentChecker::ReportingStatus mixedContentReporting = forPreload ? 511 MixedContentChecker::ReportingStatus mixedContentReporting = forPreload ?
512 MixedContentChecker::SuppressReport : MixedContentChecker::SendReport; 512 MixedContentChecker::SuppressReport : MixedContentChecker::SendReport;
513 return !MixedContentChecker::shouldBlockFetch(effectiveFrame, resourceReques t, url, mixedContentReporting); 513 return !MixedContentChecker::shouldBlockFetch(effectiveFrame, &resourceReque st, url, mixedContentReporting);
514 } 514 }
515 515
516 bool FrameFetchContext::isControlledByServiceWorker() const 516 bool FrameFetchContext::isControlledByServiceWorker() const
517 { 517 {
518 ASSERT(m_documentLoader || frame()->loader().documentLoader()); 518 ASSERT(m_documentLoader || frame()->loader().documentLoader());
519 if (m_documentLoader) 519 if (m_documentLoader)
520 return frame()->loader().client()->isControlledByServiceWorker(*m_docume ntLoader); 520 return frame()->loader().client()->isControlledByServiceWorker(*m_docume ntLoader);
521 // m_documentLoader is null while loading resources from an HTML import. 521 // m_documentLoader is null while loading resources from an HTML import.
522 // In such cases whether the request is controlled by ServiceWorker or not 522 // In such cases whether the request is controlled by ServiceWorker or not
523 // is determined by the document loader of the frame. 523 // is determined by the document loader of the frame.
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 697
698 698
699 DEFINE_TRACE(FrameFetchContext) 699 DEFINE_TRACE(FrameFetchContext)
700 { 700 {
701 visitor->trace(m_document); 701 visitor->trace(m_document);
702 visitor->trace(m_documentLoader); 702 visitor->trace(m_documentLoader);
703 FetchContext::trace(visitor); 703 FetchContext::trace(visitor);
704 } 704 }
705 705
706 } // namespace blink 706 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698