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

Side by Side Diff: third_party/WebKit/Source/web/WebRemoteFrameImpl.cpp

Issue 2483703002: Replicate feature policy headers to remote frames (Closed)
Patch Set: Get replication actually working; add layout tests Created 4 years, 1 month 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "web/WebRemoteFrameImpl.h" 5 #include "web/WebRemoteFrameImpl.h"
6 6
7 #include "core/dom/Fullscreen.h" 7 #include "core/dom/Fullscreen.h"
8 #include "core/dom/RemoteSecurityContext.h" 8 #include "core/dom/RemoteSecurityContext.h"
9 #include "core/dom/SecurityContext.h" 9 #include "core/dom/SecurityContext.h"
10 #include "core/frame/FrameView.h" 10 #include "core/frame/FrameView.h"
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 frame()->securityContext()->enforceSandboxFlags( 431 frame()->securityContext()->enforceSandboxFlags(
432 static_cast<SandboxFlags>(flags)); 432 static_cast<SandboxFlags>(flags));
433 } 433 }
434 434
435 void WebRemoteFrameImpl::setReplicatedName(const WebString& name, 435 void WebRemoteFrameImpl::setReplicatedName(const WebString& name,
436 const WebString& uniqueName) const { 436 const WebString& uniqueName) const {
437 DCHECK(frame()); 437 DCHECK(frame());
438 frame()->tree().setPrecalculatedName(name, uniqueName); 438 frame()->tree().setPrecalculatedName(name, uniqueName);
439 } 439 }
440 440
441 void WebRemoteFrameImpl::setReplicatedFeaturePolicyHeader(
alexmos 2016/11/09 01:16:55 Just to double-check: will this work in the case w
iclelland 2016/11/09 18:07:59 Definitely, I'm planning on adding a number of oth
alexmos 2016/11/10 17:50:28 That sounds great, I missed that DidSetFeaturePoli
iclelland 2016/11/16 20:21:32 Thanks for catching that -- I've fixed it now, and
442 const WebString& headerValue) const {
443 if (RuntimeEnabledFeatures::featurePolicyEnabled()) {
444 SecurityContext* childSecurityContext = frame()->securityContext();
445 FeaturePolicy* parentFeaturePolicy = nullptr;
446 if (parent()) {
447 Frame* parentFrame = frame()->client()->parent();
448 SecurityContext* parentSecurityContext = parentFrame->securityContext();
449 parentFeaturePolicy = parentSecurityContext->getFeaturePolicy();
450 }
451 std::unique_ptr<FeaturePolicy> childFeaturePolicy(
452 FeaturePolicy::createFromParentPolicy(
453 parentFeaturePolicy, childSecurityContext->getSecurityOrigin()));
Mike West 2016/11/08 12:12:23 It surprised me that you did all this work both he
iclelland 2016/11/08 14:25:45 I could certainly factor this out into a method on
alexmos 2016/11/09 01:16:55 I'm slightly in favor of the current approach, act
454 Vector<String> messages;
raymes 2016/11/07 23:10:25 I think we can ignore messages here because approp
iclelland 2016/11/08 03:13:41 Agreed; that's why we don't do anything with the m
Mike West 2016/11/08 12:12:23 1. ContentSecurityPolicy makes itself responsible
iclelland 2016/11/08 14:25:45 I like that approach, thanks!
iclelland 2016/11/09 18:07:59 I've switched it to taking an optional Vector<Stri
455 childFeaturePolicy->setHeaderPolicy(headerValue, messages);
456 childSecurityContext->setFeaturePolicy(std::move(childFeaturePolicy));
457 }
458 }
459
441 void WebRemoteFrameImpl::addReplicatedContentSecurityPolicyHeader( 460 void WebRemoteFrameImpl::addReplicatedContentSecurityPolicyHeader(
442 const WebString& headerValue, 461 const WebString& headerValue,
443 WebContentSecurityPolicyType type, 462 WebContentSecurityPolicyType type,
444 WebContentSecurityPolicySource source) const { 463 WebContentSecurityPolicySource source) const {
445 frame()->securityContext()->contentSecurityPolicy()->addPolicyFromHeaderValue( 464 frame()->securityContext()->contentSecurityPolicy()->addPolicyFromHeaderValue(
446 headerValue, static_cast<ContentSecurityPolicyHeaderType>(type), 465 headerValue, static_cast<ContentSecurityPolicyHeaderType>(type),
447 static_cast<ContentSecurityPolicyHeaderSource>(source)); 466 static_cast<ContentSecurityPolicyHeaderSource>(source));
448 } 467 }
449 468
450 void WebRemoteFrameImpl::resetReplicatedContentSecurityPolicy() const { 469 void WebRemoteFrameImpl::resetReplicatedContentSecurityPolicy() const {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 } 541 }
523 542
524 WebRemoteFrameImpl::WebRemoteFrameImpl(WebTreeScopeType scope, 543 WebRemoteFrameImpl::WebRemoteFrameImpl(WebTreeScopeType scope,
525 WebRemoteFrameClient* client) 544 WebRemoteFrameClient* client)
526 : WebRemoteFrame(scope), 545 : WebRemoteFrame(scope),
527 m_frameClient(RemoteFrameClientImpl::create(this)), 546 m_frameClient(RemoteFrameClientImpl::create(this)),
528 m_client(client), 547 m_client(client),
529 m_selfKeepAlive(this) {} 548 m_selfKeepAlive(this) {}
530 549
531 } // namespace blink 550 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698