Commit 2fd4daa1 authored by Yao Xiao's avatar Yao Xiao Committed by Commit Bot

Enabled runtime feature BlockingDownloadsInSandbox

LGTMs to ship:
https://groups.google.com/a/chromium.org/g/blink-dev/c/JdAQ6HNoZvk/m/B1aMS33oAAAJ

whatwg/html spec: https://github.com/whatwg/html/pull/4293

Bug: 539938
Change-Id: Ib875fe971ff8ab93ed733f6a0c1d4dd3ee5c7489
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2095602Reviewed-by: default avatarJochen Eisinger <jochen@chromium.org>
Commit-Queue: Yao Xiao <yaoxia@chromium.org>
Cr-Commit-Position: refs/heads/master@{#750209}
parent 88d136c0
......@@ -721,10 +721,7 @@ class DownloadFramePolicyBrowserTest_UpdateIframeSandboxFlags
// Test that when the iframe sandbox attribute is updated before navigation,
// the updated flag will be controlling the navigation-instantiating frame's
// policy for the download intervention. Given that the feature is disabled by
// default, the download will occur, but the point of the test is to track the
// use counter for whether or not the download would have been blocked by the
// policy.
// policy for the download intervention.
IN_PROC_BROWSER_TEST_P(
DownloadFramePolicyBrowserTest_UpdateIframeSandboxFlags,
PendingSandboxPolicyUsedForNavigationInstantiatingFrame) {
......@@ -732,6 +729,7 @@ IN_PROC_BROWSER_TEST_P(
bool from_allow_to_disallow;
std::tie(is_cross_origin, from_allow_to_disallow) = GetParam();
size_t number_of_downloads = from_allow_to_disallow ? 0u : 1u;
SandboxOption initial_sandbox_option =
from_allow_to_disallow ? SandboxOption::kAllowDownloads
: SandboxOption::kDisallowDownloads;
......@@ -741,7 +739,7 @@ IN_PROC_BROWSER_TEST_P(
: kSandboxTokensAllowDownloads;
InitializeHistogramTesterAndWebFeatureWaiter();
SetNumDownloadsExpectation(1);
SetNumDownloadsExpectation(number_of_downloads);
InitializeOneSubframeSetup(initial_sandbox_option, false /* is_ad_frame */,
is_cross_origin);
......@@ -769,16 +767,14 @@ IN_PROC_BROWSER_TEST_P(
// Test that when the iframe sandbox attribute is updated before navigation,
// the updated flag will NOT be controlling the navigation-initiator frame's
// policy for the download intervention. Given that the feature is disabled by
// default, the download will occur, but the point of the test is to track the
// use counter for whether or not the download would have been blocked by the
// policy.
// policy for the download intervention.
IN_PROC_BROWSER_TEST_P(DownloadFramePolicyBrowserTest_UpdateIframeSandboxFlags,
EffectiveSandboxPolicyUsedForNavigationInitiatorFrame) {
bool is_cross_origin;
bool from_allow_to_disallow;
std::tie(is_cross_origin, from_allow_to_disallow) = GetParam();
size_t number_of_downloads = from_allow_to_disallow ? 1u : 0u;
SandboxOption initial_sandbox_option =
from_allow_to_disallow ? SandboxOption::kAllowDownloads
: SandboxOption::kDisallowDownloads;
......@@ -788,7 +784,7 @@ IN_PROC_BROWSER_TEST_P(DownloadFramePolicyBrowserTest_UpdateIframeSandboxFlags,
: kSandboxTokensAllowDownloads;
InitializeHistogramTesterAndWebFeatureWaiter();
SetNumDownloadsExpectation(1);
SetNumDownloadsExpectation(number_of_downloads);
InitializeOneSubframeSetup(initial_sandbox_option, false /* is_ad_frame */,
is_cross_origin);
......
......@@ -60,10 +60,9 @@ void PossiblyWarnFeatureDeprecation(content::RenderFrameHost* rfh,
case WebFeature::kDownloadInSandbox:
rfh->AddMessageToConsole(
blink::mojom::ConsoleMessageLevel::kWarning,
"[Deprecation] Download in sandbox is deprecated and will be removed "
"in M81. You may consider adding 'allow-downloads' to the sandbox "
"attribute list. See "
"https://www.chromestatus.com/feature/5706745674465280 for more "
"Download is disallowed. The frame initiating or instantiating the "
"download is sandboxed, but the flag ‘allow-downloads’ is not set. "
"See https://www.chromestatus.com/feature/5706745674465280 for more "
"details.");
return;
case WebFeature::kDownloadInAdFrameWithoutUserGesture:
......
......@@ -246,7 +246,7 @@
},
{
name: "BlockingDownloadsInSandbox",
status: "test",
status: "stable",
},
{
name: "BlockingFocusWithoutUserActivation",
......
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