| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/loader/HttpEquiv.h" | 5 #include "core/loader/HttpEquiv.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/dom/StyleEngine.h" | 8 #include "core/dom/StyleEngine.h" |
| 9 #include "core/fetch/ClientHintsPreferences.h" | 9 #include "core/fetch/ClientHintsPreferences.h" |
| 10 #include "core/frame/UseCounter.h" | 10 #include "core/frame/UseCounter.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 void HttpEquiv::processHttpEquivXFrameOptions(Document& document, const AtomicSt
ring& content) | 89 void HttpEquiv::processHttpEquivXFrameOptions(Document& document, const AtomicSt
ring& content) |
| 90 { | 90 { |
| 91 LocalFrame* frame = document.frame(); | 91 LocalFrame* frame = document.frame(); |
| 92 if (!frame) | 92 if (!frame) |
| 93 return; | 93 return; |
| 94 | 94 |
| 95 unsigned long requestIdentifier = document.loader()->mainResourceIdentifier(
); | 95 unsigned long requestIdentifier = document.loader()->mainResourceIdentifier(
); |
| 96 if (!frame->loader().shouldInterruptLoadForXFrameOptions(content, document.u
rl(), requestIdentifier)) | 96 if (!frame->loader().shouldInterruptLoadForXFrameOptions(content, document.u
rl(), requestIdentifier)) |
| 97 return; | 97 return; |
| 98 | 98 |
| 99 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(S
ecurityMessageSource, ErrorMessageLevel, | 99 RawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(SecurityMessa
geSource, ErrorMessageLevel, |
| 100 "Refused to display '" + document.url().elidedString() + "' in a frame b
ecause it set 'X-Frame-Options' to '" + content + "'."); | 100 "Refused to display '" + document.url().elidedString() + "' in a frame b
ecause it set 'X-Frame-Options' to '" + content + "'."); |
| 101 consoleMessage->setRequestIdentifier(requestIdentifier); | 101 consoleMessage->setRequestIdentifier(requestIdentifier); |
| 102 document.addConsoleMessage(consoleMessage.release()); | 102 document.addConsoleMessage(consoleMessage.release()); |
| 103 | 103 |
| 104 frame->loader().stopAllLoaders(); | 104 frame->loader().stopAllLoaders(); |
| 105 // Stopping the loader isn't enough, as we're already parsing the document;
to honor the header's | 105 // Stopping the loader isn't enough, as we're already parsing the document;
to honor the header's |
| 106 // intent, we must navigate away from the possibly partially-rendered docume
nt to a location that | 106 // intent, we must navigate away from the possibly partially-rendered docume
nt to a location that |
| 107 // doesn't inherit the parent's SecurityOrigin. | 107 // doesn't inherit the parent's SecurityOrigin. |
| 108 // TODO(dglazkov): This should probably check document lifecycle instead. | 108 // TODO(dglazkov): This should probably check document lifecycle instead. |
| 109 if (document.frame()) | 109 if (document.frame()) |
| 110 frame->navigate(document, SecurityOrigin::urlWithUniqueSecurityOrigin(),
true, UserGestureStatus::None); | 110 frame->navigate(document, SecurityOrigin::urlWithUniqueSecurityOrigin(),
true, UserGestureStatus::None); |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // namespace blink | 113 } // namespace blink |
| OLD | NEW |