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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 memoryCache()->remove(m_mainResource.get()); | 382 memoryCache()->remove(m_mainResource.get()); |
383 | 383 |
384 m_contentSecurityPolicy = ContentSecurityPolicy::create(); | 384 m_contentSecurityPolicy = ContentSecurityPolicy::create(); |
385 m_contentSecurityPolicy->setOverrideURLForSelf(response.url()); | 385 m_contentSecurityPolicy->setOverrideURLForSelf(response.url()); |
386 m_contentSecurityPolicy->didReceiveHeaders(ContentSecurityPolicyResponseHead
ers(response)); | 386 m_contentSecurityPolicy->didReceiveHeaders(ContentSecurityPolicyResponseHead
ers(response)); |
387 if (!m_contentSecurityPolicy->allowAncestors(m_frame, response.url())) { | 387 if (!m_contentSecurityPolicy->allowAncestors(m_frame, response.url())) { |
388 cancelLoadAfterXFrameOptionsOrCSPDenied(response); | 388 cancelLoadAfterXFrameOptionsOrCSPDenied(response); |
389 return; | 389 return; |
390 } | 390 } |
391 | 391 |
392 // 'frame-ancestors' obviates 'x-frame-options': https://w3c.github.io/webap
psec/specs/content-security-policy/#frame-ancestors-and-frame-options | |
393 if (!m_contentSecurityPolicy->isFrameAncestorsEnforced()) { | |
394 HTTPHeaderMap::const_iterator it = response.httpHeaderFields().find(HTTP
Names::X_Frame_Options); | |
395 if (it != response.httpHeaderFields().end()) { | |
396 String content = it->value; | |
397 if (frameLoader()->shouldInterruptLoadForXFrameOptions(content, resp
onse.url(), mainResourceIdentifier())) { | |
398 String message = "Refused to display '" + response.url().elidedS
tring() + "' in a frame because it set 'X-Frame-Options' to '" + content + "'."; | |
399 ConsoleMessage* consoleMessage = ConsoleMessage::create(Security
MessageSource, ErrorMessageLevel, message); | |
400 consoleMessage->setRequestIdentifier(mainResourceIdentifier()); | |
401 frame()->document()->addConsoleMessage(consoleMessage); | |
402 | |
403 cancelLoadAfterXFrameOptionsOrCSPDenied(response); | |
404 return; | |
405 } | |
406 } | |
407 } | |
408 | |
409 ASSERT(!m_frame->page()->defersLoading()); | 392 ASSERT(!m_frame->page()->defersLoading()); |
410 | 393 |
411 m_response = response; | 394 m_response = response; |
412 | 395 |
413 if (isArchiveMIMEType(m_response.mimeType()) && m_mainResource->getDataBuffe
ringPolicy() != BufferData) | 396 if (isArchiveMIMEType(m_response.mimeType()) && m_mainResource->getDataBuffe
ringPolicy() != BufferData) |
414 m_mainResource->setDataBufferingPolicy(BufferData); | 397 m_mainResource->setDataBufferingPolicy(BufferData); |
415 | 398 |
416 if (!shouldContinueForResponse()) { | 399 if (!shouldContinueForResponse()) { |
417 InspectorInstrumentation::continueWithPolicyIgnore(m_frame, this, m_main
Resource->identifier(), m_response); | 400 InspectorInstrumentation::continueWithPolicyIgnore(m_frame, this, m_main
Resource->identifier(), m_response); |
418 m_fetcher->stopFetching(); | 401 m_fetcher->stopFetching(); |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 { | 675 { |
693 m_writer = createWriterFor(init, mimeType(), m_writer ? m_writer->encoding()
: emptyAtom, true, ForceSynchronousParsing); | 676 m_writer = createWriterFor(init, mimeType(), m_writer ? m_writer->encoding()
: emptyAtom, true, ForceSynchronousParsing); |
694 if (!source.isNull()) | 677 if (!source.isNull()) |
695 m_writer->appendReplacingData(source); | 678 m_writer->appendReplacingData(source); |
696 endWriting(m_writer.get()); | 679 endWriting(m_writer.get()); |
697 } | 680 } |
698 | 681 |
699 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); | 682 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); |
700 | 683 |
701 } // namespace blink | 684 } // namespace blink |
OLD | NEW |