OLD | NEW |
---|---|
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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
301 | 301 |
302 // If the redirecting url is not allowed to display content from the target origin, | 302 // If the redirecting url is not allowed to display content from the target origin, |
303 // then block the redirect. | 303 // then block the redirect. |
304 const KURL& requestURL = m_request.url(); | 304 const KURL& requestURL = m_request.url(); |
305 RefPtr<SecurityOrigin> redirectingOrigin = SecurityOrigin::create(redirectRe sponse.url()); | 305 RefPtr<SecurityOrigin> redirectingOrigin = SecurityOrigin::create(redirectRe sponse.url()); |
306 if (!redirectingOrigin->canDisplay(requestURL)) { | 306 if (!redirectingOrigin->canDisplay(requestURL)) { |
307 FrameLoader::reportLocalLoadFailed(m_frame, requestURL.getString()); | 307 FrameLoader::reportLocalLoadFailed(m_frame, requestURL.getString()); |
308 m_fetcher->stopFetching(); | 308 m_fetcher->stopFetching(); |
309 return; | 309 return; |
310 } | 310 } |
311 if (!frameLoader()->shouldContinueForNavigationPolicy(m_request, SubstituteD ata(), this, CheckContentSecurityPolicy, m_navigationType, NavigationPolicyCurre ntTab, replacesCurrentHistoryItem(), isClientRedirect())) { | 311 if (!frameLoader()->shouldContinueForNavigationPolicy(m_request, SubstituteD ata(), this, m_navigationType, NavigationPolicyCurrentTab, replacesCurrentHistor yItem(), isClientRedirect())) { |
312 m_fetcher->stopFetching(); | 312 m_fetcher->stopFetching(); |
313 return; | 313 return; |
314 } | 314 } |
315 | 315 |
316 ASSERT(timing().fetchStart()); | 316 ASSERT(timing().fetchStart()); |
317 timing().addRedirect(redirectResponse.url(), requestURL); | 317 timing().addRedirect(redirectResponse.url(), requestURL); |
318 appendRedirect(requestURL); | 318 appendRedirect(requestURL); |
319 frameLoader()->receivedMainResourceRedirect(requestURL); | 319 frameLoader()->receivedMainResourceRedirect(requestURL); |
320 } | 320 } |
321 | 321 |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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::startLoadingMainResource() | 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 | |
618 void DocumentLoader::startLoadingMainResource(ContentSecurityPolicyDisposition c spDisposition) | |
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); |
635 fetchRequest.setContentSecurityCheck(cspDisposition); | |
636 | |
628 m_mainResource = RawResource::fetchMainResource(fetchRequest, fetcher(), m_s ubstituteData); | 637 m_mainResource = RawResource::fetchMainResource(fetchRequest, fetcher(), m_s ubstituteData); |
629 if (!m_mainResource) { | 638 if (!m_mainResource) { |
630 m_request = ResourceRequest(blankURL()); | 639 loadUnique(); |
Yoav Weiss
2016/06/02 14:13:37
What's the reason for this change?
Mike West
2016/06/02 14:25:45
Blocking the response ought to leave us with a doc
Yoav Weiss
2016/06/02 14:28:07
OK, cool!
alexmos
2016/06/02 22:21:07
Probably not for this CL, but I'm curious if we sh
Mike West
2016/06/06 08:40:10
Makes sense. I'll reevaluate that once we re-land
| |
631 maybeLoadEmpty(); | |
632 return; | 640 return; |
633 } | 641 } |
634 // A bunch of headers are set when the underlying ResourceLoader is created, and m_request needs to include those. | 642 // 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. | 643 // 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(); | 644 m_request = mainResourceLoader() ? m_mainResource->resourceRequest() : fetch Request.resourceRequest(); |
637 m_mainResource->addClient(this); | 645 m_mainResource->addClient(this); |
638 } | 646 } |
639 | 647 |
640 void DocumentLoader::endWriting(DocumentWriter* writer) | 648 void DocumentLoader::endWriting(DocumentWriter* writer) |
641 { | 649 { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
684 { | 692 { |
685 m_writer = createWriterFor(init, mimeType(), m_writer ? m_writer->encoding() : emptyAtom, true, ForceSynchronousParsing); | 693 m_writer = createWriterFor(init, mimeType(), m_writer ? m_writer->encoding() : emptyAtom, true, ForceSynchronousParsing); |
686 if (!source.isNull()) | 694 if (!source.isNull()) |
687 m_writer->appendReplacingData(source); | 695 m_writer->appendReplacingData(source); |
688 endWriting(m_writer.get()); | 696 endWriting(m_writer.get()); |
689 } | 697 } |
690 | 698 |
691 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); | 699 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); |
692 | 700 |
693 } // namespace blink | 701 } // namespace blink |
OLD | NEW |