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

Side by Side Diff: third_party/WebKit/Source/core/loader/DocumentLoader.cpp

Issue 2022083002: Move 'frame-src' CSP checks into FrameFetchContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase+Content+Sandbox 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) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 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 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 if (!shouldLoadEmpty) 601 if (!shouldLoadEmpty)
602 return false; 602 return false;
603 603
604 if (m_request.url().isEmpty() && !frameLoader()->stateMachine()->creatingIni tialEmptyDocument()) 604 if (m_request.url().isEmpty() && !frameLoader()->stateMachine()->creatingIni tialEmptyDocument())
605 m_request.setURL(blankURL()); 605 m_request.setURL(blankURL());
606 m_response = ResourceResponse(m_request.url(), "text/html", 0, nullAtom, Str ing()); 606 m_response = ResourceResponse(m_request.url(), "text/html", 0, nullAtom, Str ing());
607 finishedLoading(monotonicallyIncreasingTime()); 607 finishedLoading(monotonicallyIncreasingTime());
608 return true; 608 return true;
609 } 609 }
610 610
611 void DocumentLoader::loadUnique()
612 {
613 m_request = ResourceRequest(SecurityOrigin::urlWithUniqueSecurityOrigin());
614 m_response = ResourceResponse(m_request.url(), "text/html", 0, nullAtom, Str ing());
615 finishedLoading(monotonicallyIncreasingTime());
616 }
617
611 void DocumentLoader::startLoadingMainResource() 618 void DocumentLoader::startLoadingMainResource()
612 { 619 {
613 timing().markNavigationStart(); 620 timing().markNavigationStart();
614 ASSERT(!m_mainResource); 621 ASSERT(!m_mainResource);
615 ASSERT(m_state == NotStarted); 622 ASSERT(m_state == NotStarted);
616 m_state = Provisional; 623 m_state = Provisional;
617 624
618 if (maybeLoadEmpty()) 625 if (maybeLoadEmpty())
619 return; 626 return;
620 627
621 ASSERT(timing().navigationStart()); 628 ASSERT(timing().navigationStart());
622 ASSERT(!timing().fetchStart()); 629 ASSERT(!timing().fetchStart());
623 timing().markFetchStart(); 630 timing().markFetchStart();
624 631
625 DEFINE_STATIC_LOCAL(ResourceLoaderOptions, mainResourceLoadOptions, 632 DEFINE_STATIC_LOCAL(ResourceLoaderOptions, mainResourceLoadOptions,
626 (DoNotBufferData, AllowStoredCredentials, ClientRequestedCredentials, Ch eckContentSecurityPolicy, DocumentContext)); 633 (DoNotBufferData, AllowStoredCredentials, ClientRequestedCredentials, Ch eckContentSecurityPolicy, DocumentContext));
627 FetchRequest fetchRequest(m_request, FetchInitiatorTypeNames::document, main ResourceLoadOptions); 634 FetchRequest fetchRequest(m_request, FetchInitiatorTypeNames::document, main ResourceLoadOptions);
628 m_mainResource = RawResource::fetchMainResource(fetchRequest, fetcher(), m_s ubstituteData); 635 m_mainResource = RawResource::fetchMainResource(fetchRequest, fetcher(), m_s ubstituteData);
629 if (!m_mainResource) { 636 if (!m_mainResource) {
630 m_request = ResourceRequest(blankURL()); 637 loadUnique();
631 maybeLoadEmpty();
632 return; 638 return;
633 } 639 }
634 // A bunch of headers are set when the underlying ResourceLoader is created, and m_request needs to include those. 640 // A bunch of headers are set when the underlying ResourceLoader is created, and m_request needs to include those.
635 // Even when using a cached resource, we may make some modification to the r equest, e.g. adding the referer header. 641 // Even when using a cached resource, we may make some modification to the r equest, e.g. adding the referer header.
636 m_request = mainResourceLoader() ? m_mainResource->resourceRequest() : fetch Request.resourceRequest(); 642 m_request = mainResourceLoader() ? m_mainResource->resourceRequest() : fetch Request.resourceRequest();
637 m_mainResource->addClient(this); 643 m_mainResource->addClient(this);
638 } 644 }
639 645
640 void DocumentLoader::endWriting(DocumentWriter* writer) 646 void DocumentLoader::endWriting(DocumentWriter* writer)
641 { 647 {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 { 690 {
685 m_writer = createWriterFor(init, mimeType(), m_writer ? m_writer->encoding() : emptyAtom, true, ForceSynchronousParsing); 691 m_writer = createWriterFor(init, mimeType(), m_writer ? m_writer->encoding() : emptyAtom, true, ForceSynchronousParsing);
686 if (!source.isNull()) 692 if (!source.isNull())
687 m_writer->appendReplacingData(source); 693 m_writer->appendReplacingData(source);
688 endWriting(m_writer.get()); 694 endWriting(m_writer.get());
689 } 695 }
690 696
691 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); 697 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader);
692 698
693 } // namespace blink 699 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698