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

Unified Diff: third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp

Issue 2797813002: Replicate feature policy container policies. (Closed)
Patch Set: Rebase after the great Blink rename Created 3 years, 8 months 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp b/third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp
index ca3bb0fb6accf5aba82e5ddc6a64babf9d522291..5a12886c93dba6ab8de3c54fc701253bf96afcf1 100644
--- a/third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp
@@ -163,6 +163,20 @@ void HTMLFrameElementBase::ParseAttribute(
}
}
+const RefPtr<SecurityOrigin> HTMLFrameElementBase::GetOriginForFeaturePolicy()
+ const {
+ KURL url = GetDocument().CompleteURL(url_);
+ // Sandboxed frames and data: urls have a unique origin.
+ if (url.ProtocolIsData() || (GetSandboxFlags() & kSandboxOrigin))
alexmos 2017/04/11 01:17:49 Checking data: explicitly might not actually be ne
alexmos 2017/04/11 01:17:49 nit: use IsSandboxed(kSandboxOrigin)
iclelland 2017/04/11 17:41:43 I thought that was only defined on SecurityContext
iclelland 2017/04/11 17:41:43 You're right there, thanks. SecurityOrigin::Create
alexmos 2017/04/13 02:09:15 The ProtocolIsData() check still seems to be there
alexmos 2017/04/13 02:09:15 Ah, right, this is for a frame owner, not a docume
iclelland 2017/04/13 19:05:31 Thanks for catching that. Done.
+ return SecurityOrigin::CreateUnique();
+ // Frames with about:blank and javascript: urls inherit their origin from
+ // their parent frame.
+ if (url.ProtocolIsJavaScript() || url.IsAboutBlankURL())
alexmos 2017/04/11 01:17:49 Do you also need to handle the case where |url| is
iclelland 2017/04/11 17:41:43 That's a good idea -- it's not currently exported
alexmos 2017/04/13 02:09:15 Yes, I assumed that we'd need to export it more wi
+ return GetDocument().GetSecurityOrigin();
+ // Otherwise, return the origin of the absolute URL.
+ return SecurityOrigin::Create(url);
+}
+
void HTMLFrameElementBase::SetNameAndOpenURL() {
frame_name_ = GetNameAttribute();
OpenURL();

Powered by Google App Engine
This is Rietveld 408576698