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

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

Issue 788923003: Adding Link header support for dns-prefetch (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: removed useless dumpAsText from frames Created 5 years, 10 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 30 matching lines...) Expand all
41 #include "core/frame/LocalDOMWindow.h" 41 #include "core/frame/LocalDOMWindow.h"
42 #include "core/frame/LocalFrame.h" 42 #include "core/frame/LocalFrame.h"
43 #include "core/frame/csp/ContentSecurityPolicy.h" 43 #include "core/frame/csp/ContentSecurityPolicy.h"
44 #include "core/html/HTMLFrameOwnerElement.h" 44 #include "core/html/HTMLFrameOwnerElement.h"
45 #include "core/html/parser/HTMLDocumentParser.h" 45 #include "core/html/parser/HTMLDocumentParser.h"
46 #include "core/html/parser/TextResourceDecoder.h" 46 #include "core/html/parser/TextResourceDecoder.h"
47 #include "core/html/parser/ThreadedDataReceiver.h" 47 #include "core/html/parser/ThreadedDataReceiver.h"
48 #include "core/inspector/InspectorInstrumentation.h" 48 #include "core/inspector/InspectorInstrumentation.h"
49 #include "core/loader/FrameLoader.h" 49 #include "core/loader/FrameLoader.h"
50 #include "core/loader/FrameLoaderClient.h" 50 #include "core/loader/FrameLoaderClient.h"
51 #include "core/loader/LinkLoader.h"
51 #include "core/loader/UniqueIdentifier.h" 52 #include "core/loader/UniqueIdentifier.h"
52 #include "core/loader/appcache/ApplicationCacheHost.h" 53 #include "core/loader/appcache/ApplicationCacheHost.h"
53 #include "core/page/FrameTree.h" 54 #include "core/page/FrameTree.h"
54 #include "core/page/Page.h" 55 #include "core/page/Page.h"
55 #include "core/frame/Settings.h" 56 #include "core/frame/Settings.h"
56 #include "core/inspector/ConsoleMessage.h" 57 #include "core/inspector/ConsoleMessage.h"
57 #include "platform/Logging.h" 58 #include "platform/Logging.h"
58 #include "platform/UserGestureIndicator.h" 59 #include "platform/UserGestureIndicator.h"
59 #include "platform/mhtml/ArchiveResource.h" 60 #include "platform/mhtml/ArchiveResource.h"
60 #include "platform/mhtml/ArchiveResourceCollection.h" 61 #include "platform/mhtml/ArchiveResourceCollection.h"
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 if (frameLoader()) 403 if (frameLoader())
403 cancelMainResourceLoad(ResourceError::cancelledError(m_request.url())); 404 cancelMainResourceLoad(ResourceError::cancelledError(m_request.url()));
404 return; 405 return;
405 } 406 }
406 407
407 void DocumentLoader::responseReceived(Resource* resource, const ResourceResponse & response, PassOwnPtr<WebDataConsumerHandle> handle) 408 void DocumentLoader::responseReceived(Resource* resource, const ResourceResponse & response, PassOwnPtr<WebDataConsumerHandle> handle)
408 { 409 {
409 ASSERT_UNUSED(resource, m_mainResource == resource); 410 ASSERT_UNUSED(resource, m_mainResource == resource);
410 ASSERT_UNUSED(handle, !handle); 411 ASSERT_UNUSED(handle, !handle);
411 RefPtr<DocumentLoader> protect(this); 412 RefPtr<DocumentLoader> protect(this);
413 ASSERT(frame());
412 414
413 m_applicationCacheHost->didReceiveResponseForMainResource(response); 415 m_applicationCacheHost->didReceiveResponseForMainResource(response);
414 416
415 // The memory cache doesn't understand the application cache or its caching rules. So if a main resource is served 417 // The memory cache doesn't understand the application cache or its caching rules. So if a main resource is served
416 // from the application cache, ensure we don't save the result for future us e. All responses loaded 418 // from the application cache, ensure we don't save the result for future us e. All responses loaded
417 // from appcache will have a non-zero appCacheID(). 419 // from appcache will have a non-zero appCacheID().
418 if (response.appCacheID()) 420 if (response.appCacheID())
419 memoryCache()->remove(m_mainResource.get()); 421 memoryCache()->remove(m_mainResource.get());
420 422
421 DEFINE_STATIC_LOCAL(AtomicString, xFrameOptionHeader, ("x-frame-options", At omicString::ConstructFromLiteral)); 423 DEFINE_STATIC_LOCAL(AtomicString, xFrameOptionHeader, ("x-frame-options", At omicString::ConstructFromLiteral));
(...skipping 12 matching lines...) Expand all
434 } 436 }
435 437
436 m_contentSecurityPolicy = ContentSecurityPolicy::create(); 438 m_contentSecurityPolicy = ContentSecurityPolicy::create();
437 m_contentSecurityPolicy->setOverrideURLForSelf(response.url()); 439 m_contentSecurityPolicy->setOverrideURLForSelf(response.url());
438 m_contentSecurityPolicy->didReceiveHeaders(ContentSecurityPolicyResponseHead ers(response)); 440 m_contentSecurityPolicy->didReceiveHeaders(ContentSecurityPolicyResponseHead ers(response));
439 if (!m_contentSecurityPolicy->allowAncestors(m_frame, response.url())) { 441 if (!m_contentSecurityPolicy->allowAncestors(m_frame, response.url())) {
440 cancelLoadAfterXFrameOptionsOrCSPDenied(response); 442 cancelLoadAfterXFrameOptionsOrCSPDenied(response);
441 return; 443 return;
442 } 444 }
443 445
446 if (resource && resource->type() == Resource::MainResource)
447 LinkLoader::loadLinkFromHeader(response.httpHeaderField("Link"), frame() ->document());
448
444 ASSERT(!mainResourceLoader() || !mainResourceLoader()->defersLoading()); 449 ASSERT(!mainResourceLoader() || !mainResourceLoader()->defersLoading());
445 450
446 m_response = response; 451 m_response = response;
447 452
448 if (isArchiveMIMEType(m_response.mimeType()) && m_mainResource->dataBufferin gPolicy() != BufferData) 453 if (isArchiveMIMEType(m_response.mimeType()) && m_mainResource->dataBufferin gPolicy() != BufferData)
449 m_mainResource->setDataBufferingPolicy(BufferData); 454 m_mainResource->setDataBufferingPolicy(BufferData);
450 455
451 if (!shouldContinueForResponse()) { 456 if (!shouldContinueForResponse()) {
452 InspectorInstrumentation::continueWithPolicyIgnore(m_frame, this, m_main Resource->identifier(), m_response); 457 InspectorInstrumentation::continueWithPolicyIgnore(m_frame, this, m_main Resource->identifier(), m_response);
453 cancelMainResourceLoad(ResourceError::cancelledError(m_request.url())); 458 cancelMainResourceLoad(ResourceError::cancelledError(m_request.url()));
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 // This is only called by FrameLoader::replaceDocumentWhileExecutingJavaScriptUR L() 815 // This is only called by FrameLoader::replaceDocumentWhileExecutingJavaScriptUR L()
811 void DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL(const DocumentIn it& init, const String& source, Document* ownerDocument) 816 void DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL(const DocumentIn it& init, const String& source, Document* ownerDocument)
812 { 817 {
813 m_writer = createWriterFor(ownerDocument, init, mimeType(), m_writer ? m_wri ter->encoding() : emptyAtom, true, ForceSynchronousParsing); 818 m_writer = createWriterFor(ownerDocument, init, mimeType(), m_writer ? m_wri ter->encoding() : emptyAtom, true, ForceSynchronousParsing);
814 if (!source.isNull()) 819 if (!source.isNull())
815 m_writer->appendReplacingData(source); 820 m_writer->appendReplacingData(source);
816 endWriting(m_writer.get()); 821 endWriting(m_writer.get());
817 } 822 }
818 823
819 } // namespace blink 824 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/linkHeader/resources/link-dnsprefetch-frame.php ('k') | Source/core/loader/LinkLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698