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 30 matching lines...) Expand all Loading... | |
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 Loading... | |
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 Loading... | |
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) | |
Mike West
2015/02/06 12:22:06
Do we not load for subframes?
| |
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 Loading... | |
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 |
OLD | NEW |