Commit dd3fb090 authored by Ian Clelland's avatar Ian Clelland Committed by Chromium LUCI CQ

Remove allowed_to_download from frame policy

This was previously used to cache the effect of the
"download-without-user-activation" policy, but since the removal of
FeaturePolicyForSandbox, it is no longer read anywhere, so this is all dead code.

Change-Id: I9eb574d447cabcfa7d9499366aa498bc9c7985c2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2575100
Commit-Queue: Ian Clelland <iclelland@chromium.org>
Reviewed-by: default avatarMike West <mkwst@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarCharlie Hu <chenleihu@google.com>
Cr-Commit-Position: refs/heads/master@{#834704}
parent 97617a60
...@@ -176,7 +176,6 @@ IPC_STRUCT_TRAITS_BEGIN(blink::FramePolicy) ...@@ -176,7 +176,6 @@ IPC_STRUCT_TRAITS_BEGIN(blink::FramePolicy)
IPC_STRUCT_TRAITS_MEMBER(sandbox_flags) IPC_STRUCT_TRAITS_MEMBER(sandbox_flags)
IPC_STRUCT_TRAITS_MEMBER(container_policy) IPC_STRUCT_TRAITS_MEMBER(container_policy)
IPC_STRUCT_TRAITS_MEMBER(required_document_policy) IPC_STRUCT_TRAITS_MEMBER(required_document_policy)
IPC_STRUCT_TRAITS_MEMBER(allowed_to_download)
IPC_STRUCT_TRAITS_MEMBER(disallow_document_access) IPC_STRUCT_TRAITS_MEMBER(disallow_document_access)
IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_END()
......
...@@ -153,7 +153,7 @@ TestRenderFrameHost* TestRenderFrameHost::AppendChildWithPolicy( ...@@ -153,7 +153,7 @@ TestRenderFrameHost* TestRenderFrameHost::AppendChildWithPolicy(
blink::mojom::TreeScopeType::kDocument, frame_name, frame_unique_name, blink::mojom::TreeScopeType::kDocument, frame_name, frame_unique_name,
false, base::UnguessableToken::Create(), base::UnguessableToken::Create(), false, base::UnguessableToken::Create(), base::UnguessableToken::Create(),
blink::FramePolicy( blink::FramePolicy(
{network::mojom::WebSandboxFlags::kNone, allow, {}, true, false}), {network::mojom::WebSandboxFlags::kNone, allow, {}, false}),
blink::mojom::FrameOwnerProperties(), blink::mojom::FrameOwnerProperties(),
blink::mojom::FrameOwnerElementType::kIframe); blink::mojom::FrameOwnerElementType::kIframe);
return static_cast<TestRenderFrameHost*>( return static_cast<TestRenderFrameHost*>(
......
...@@ -11,19 +11,16 @@ FramePolicy::FramePolicy() ...@@ -11,19 +11,16 @@ FramePolicy::FramePolicy()
: sandbox_flags(network::mojom::WebSandboxFlags::kNone), : sandbox_flags(network::mojom::WebSandboxFlags::kNone),
container_policy({}), container_policy({}),
required_document_policy({}), required_document_policy({}),
allowed_to_download(true),
disallow_document_access(false) {} disallow_document_access(false) {}
FramePolicy::FramePolicy( FramePolicy::FramePolicy(
network::mojom::WebSandboxFlags sandbox_flags, network::mojom::WebSandboxFlags sandbox_flags,
const ParsedFeaturePolicy& container_policy, const ParsedFeaturePolicy& container_policy,
const DocumentPolicyFeatureState& required_document_policy, const DocumentPolicyFeatureState& required_document_policy,
bool allowed_to_download,
bool disallow_document_access) bool disallow_document_access)
: sandbox_flags(sandbox_flags), : sandbox_flags(sandbox_flags),
container_policy(container_policy), container_policy(container_policy),
required_document_policy(required_document_policy), required_document_policy(required_document_policy),
allowed_to_download(allowed_to_download),
disallow_document_access(disallow_document_access) {} disallow_document_access(disallow_document_access) {}
FramePolicy::FramePolicy(const FramePolicy& lhs) = default; FramePolicy::FramePolicy(const FramePolicy& lhs) = default;
......
...@@ -9,7 +9,6 @@ namespace mojo { ...@@ -9,7 +9,6 @@ namespace mojo {
bool StructTraits<blink::mojom::FramePolicyDataView, blink::FramePolicy>::Read( bool StructTraits<blink::mojom::FramePolicyDataView, blink::FramePolicy>::Read(
blink::mojom::FramePolicyDataView in, blink::mojom::FramePolicyDataView in,
blink::FramePolicy* out) { blink::FramePolicy* out) {
out->allowed_to_download = in.allowed_to_download();
out->disallow_document_access = in.disallow_document_access(); out->disallow_document_access = in.disallow_document_access();
// TODO(chenleihu): Add sanity check on enum values in // TODO(chenleihu): Add sanity check on enum values in
......
...@@ -16,10 +16,6 @@ template <> ...@@ -16,10 +16,6 @@ template <>
class BLINK_COMMON_EXPORT class BLINK_COMMON_EXPORT
StructTraits<blink::mojom::FramePolicyDataView, blink::FramePolicy> { StructTraits<blink::mojom::FramePolicyDataView, blink::FramePolicy> {
public: public:
static bool allowed_to_download(const blink::FramePolicy& frame_policy) {
return frame_policy.allowed_to_download;
}
static bool disallow_document_access(const blink::FramePolicy& frame_policy) { static bool disallow_document_access(const blink::FramePolicy& frame_policy) {
return frame_policy.disallow_document_access; return frame_policy.disallow_document_access;
} }
......
...@@ -28,7 +28,6 @@ struct BLINK_COMMON_EXPORT FramePolicy { ...@@ -28,7 +28,6 @@ struct BLINK_COMMON_EXPORT FramePolicy {
FramePolicy(network::mojom::WebSandboxFlags sandbox_flags, FramePolicy(network::mojom::WebSandboxFlags sandbox_flags,
const ParsedFeaturePolicy& container_policy, const ParsedFeaturePolicy& container_policy,
const DocumentPolicyFeatureState& required_document_policy, const DocumentPolicyFeatureState& required_document_policy,
bool allowed_to_download = true,
bool disallow_document_access = false); bool disallow_document_access = false);
FramePolicy(const FramePolicy& lhs); FramePolicy(const FramePolicy& lhs);
~FramePolicy(); ~FramePolicy();
...@@ -40,14 +39,6 @@ struct BLINK_COMMON_EXPORT FramePolicy { ...@@ -40,14 +39,6 @@ struct BLINK_COMMON_EXPORT FramePolicy {
// - 'Require-Document-Policy' http header // - 'Require-Document-Policy' http header
// - |required_document_policy| of parent frame // - |required_document_policy| of parent frame
DocumentPolicyFeatureState required_document_policy; DocumentPolicyFeatureState required_document_policy;
// With FeaturePolicyForSandbox, as a policy affecting the document,
// "downloads" is included in |container_policy|.
// However, in certain cases where the initiator of the navigation is not the
// document itself (e.g., a parent document), the FrameOwner element should be
// checked for "downloads" flag. If this boolean is false then navigations
// leading to downloads should be blocked. Note: this flag is currently only
// set if the frame is sandboxed for downloads.
bool allowed_to_download;
// Whether or not a frame allows direct script access across frame // Whether or not a frame allows direct script access across frame
// boundaries. // boundaries.
......
...@@ -18,6 +18,5 @@ struct FramePolicy { ...@@ -18,6 +18,5 @@ struct FramePolicy {
network.mojom.WebSandboxFlags sandbox_flags; network.mojom.WebSandboxFlags sandbox_flags;
array<blink.mojom.ParsedFeaturePolicyDeclaration> container_policy; array<blink.mojom.ParsedFeaturePolicyDeclaration> container_policy;
map<blink.mojom.DocumentPolicyFeature, blink.mojom.PolicyValue> required_document_policy; map<blink.mojom.DocumentPolicyFeature, blink.mojom.PolicyValue> required_document_policy;
bool allowed_to_download = true;
bool disallow_document_access = false; bool disallow_document_access = false;
}; };
...@@ -138,9 +138,6 @@ class CORE_EXPORT HTMLFrameOwnerElement : public HTMLElement, ...@@ -138,9 +138,6 @@ class CORE_EXPORT HTMLFrameOwnerElement : public HTMLElement,
HTMLFrameOwnerElement(const QualifiedName& tag_name, Document&); HTMLFrameOwnerElement(const QualifiedName& tag_name, Document&);
void SetSandboxFlags(network::mojom::blink::WebSandboxFlags); void SetSandboxFlags(network::mojom::blink::WebSandboxFlags);
void SetAllowedToDownload(bool allowed) {
frame_policy_.allowed_to_download = allowed;
}
void SetDisallowDocumentAccesss(bool disallowed); void SetDisallowDocumentAccesss(bool disallowed);
bool LoadOrRedirectSubframe(const KURL&, bool LoadOrRedirectSubframe(const KURL&,
......
...@@ -175,9 +175,6 @@ void HTMLIFrameElement::ParseAttribute( ...@@ -175,9 +175,6 @@ void HTMLIFrameElement::ParseAttribute(
parsed.error_message))); parsed.error_message)));
} }
} }
SetAllowedToDownload(
(current_flags & network::mojom::blink::WebSandboxFlags::kDownloads) ==
network::mojom::blink::WebSandboxFlags::kNone);
SetSandboxFlags(current_flags); SetSandboxFlags(current_flags);
UseCounter::Count(GetDocument(), WebFeature::kSandboxViaIFrame); UseCounter::Count(GetDocument(), WebFeature::kSandboxViaIFrame);
} else if (name == html_names::kReferrerpolicyAttr) { } else if (name == html_names::kReferrerpolicyAttr) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment