Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 6 * (http://www.torchmobile.com/) | 6 * (http://www.torchmobile.com/) |
| 7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> | 7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
| 8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. | 8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. |
| 9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> | 9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> |
| 10 * Copyright (C) 2011 Google Inc. All rights reserved. | 10 * Copyright (C) 2011 Google Inc. All rights reserved. |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 570 if (!headerContentLanguage.isEmpty()) { | 570 if (!headerContentLanguage.isEmpty()) { |
| 571 m_frame->document()->setContentLanguage( | 571 m_frame->document()->setContentLanguage( |
| 572 AtomicString(headerContentLanguage)); | 572 AtomicString(headerContentLanguage)); |
| 573 } | 573 } |
| 574 } | 574 } |
| 575 | 575 |
| 576 OriginTrialContext::addTokensFromHeader( | 576 OriginTrialContext::addTokensFromHeader( |
| 577 m_frame->document(), | 577 m_frame->document(), |
| 578 m_documentLoader->response().httpHeaderField(HTTPNames::Origin_Trial)); | 578 m_documentLoader->response().httpHeaderField(HTTPNames::Origin_Trial)); |
| 579 if (RuntimeEnabledFeatures::featurePolicyEnabled()) { | 579 if (RuntimeEnabledFeatures::featurePolicyEnabled()) { |
| 580 std::unique_ptr<FeaturePolicy> featurePolicy( | 580 SecurityContext* parentSecurityContext = |
| 581 FeaturePolicy::createFromParentPolicy( | 581 (isLoadingMainFrame() |
| 582 (isLoadingMainFrame() ? nullptr | 582 ? nullptr |
| 583 : m_frame->client() | 583 : m_frame->client()->parent()->securityContext()); |
| 584 ->parent() | 584 const String& featurePolicyHeader = |
| 585 ->securityContext() | 585 m_documentLoader->response().httpHeaderField( |
| 586 ->getFeaturePolicy()), | 586 HTTPNames::Feature_Policy); |
| 587 m_frame->securityContext()->getSecurityOrigin())); | |
| 588 Vector<String> messages; | 587 Vector<String> messages; |
| 589 featurePolicy->setHeaderPolicy( | 588 m_frame->securityContext()->setFeaturePolicyFromHeader( |
|
raymes
2016/11/21 02:17:34
nit: since only the parent's feature policy is rea
iclelland
2016/11/21 05:05:33
Makes sense; I was thinking that methods on Securi
| |
| 590 m_documentLoader->response().httpHeaderField( | 589 featurePolicyHeader, parentSecurityContext, &messages); |
| 591 HTTPNames::Feature_Policy), | |
| 592 messages); | |
| 593 for (auto& message : messages) { | 590 for (auto& message : messages) { |
| 594 m_frame->document()->addConsoleMessage(ConsoleMessage::create( | 591 m_frame->document()->addConsoleMessage(ConsoleMessage::create( |
| 595 OtherMessageSource, ErrorMessageLevel, | 592 OtherMessageSource, ErrorMessageLevel, |
| 596 "Error with Feature-Policy header: " + message)); | 593 "Error with Feature-Policy header: " + message)); |
| 597 } | 594 } |
| 598 m_frame->document()->setFeaturePolicy(std::move(featurePolicy)); | 595 if (client() && !featurePolicyHeader.isEmpty()) |
|
dcheng
2016/11/20 21:04:12
Is this null check necessary? The frame should be
iclelland
2016/11/21 05:05:33
I wasn't 100% certain that that had to be the case
| |
| 596 client()->didSetFeaturePolicyHeader(featurePolicyHeader); | |
| 599 } | 597 } |
| 600 } | 598 } |
| 601 | 599 |
| 602 if (m_documentLoader) { | 600 if (m_documentLoader) { |
| 603 String referrerPolicyHeader = m_documentLoader->response().httpHeaderField( | 601 String referrerPolicyHeader = m_documentLoader->response().httpHeaderField( |
| 604 HTTPNames::Referrer_Policy); | 602 HTTPNames::Referrer_Policy); |
| 605 if (!referrerPolicyHeader.isNull()) { | 603 if (!referrerPolicyHeader.isNull()) { |
| 606 m_frame->document()->parseAndSetReferrerPolicy(referrerPolicyHeader); | 604 m_frame->document()->parseAndSetReferrerPolicy(referrerPolicyHeader); |
| 607 } | 605 } |
| 608 } | 606 } |
| (...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1952 m_documentLoader ? m_documentLoader->url() : String()); | 1950 m_documentLoader ? m_documentLoader->url() : String()); |
| 1953 return tracedValue; | 1951 return tracedValue; |
| 1954 } | 1952 } |
| 1955 | 1953 |
| 1956 inline void FrameLoader::takeObjectSnapshot() const { | 1954 inline void FrameLoader::takeObjectSnapshot() const { |
| 1957 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, | 1955 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, |
| 1958 toTracedValue()); | 1956 toTracedValue()); |
| 1959 } | 1957 } |
| 1960 | 1958 |
| 1961 } // namespace blink | 1959 } // namespace blink |
| OLD | NEW |