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 ...@@ -721,10 +721,7 @@ class DownloadFramePolicyBrowserTest_UpdateIframeSandboxFlags
// Test that when the iframe sandbox attribute is updated before navigation, // Test that when the iframe sandbox attribute is updated before navigation,
// the updated flag will be controlling the navigation-instantiating frame's // the updated flag will be controlling the navigation-instantiating frame's
// policy for the download intervention. Given that the feature is disabled by // policy for the download intervention.
// 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.
IN_PROC_BROWSER_TEST_P( IN_PROC_BROWSER_TEST_P(
DownloadFramePolicyBrowserTest_UpdateIframeSandboxFlags, DownloadFramePolicyBrowserTest_UpdateIframeSandboxFlags,
PendingSandboxPolicyUsedForNavigationInstantiatingFrame) { PendingSandboxPolicyUsedForNavigationInstantiatingFrame) {
...@@ -732,6 +729,7 @@ IN_PROC_BROWSER_TEST_P( ...@@ -732,6 +729,7 @@ IN_PROC_BROWSER_TEST_P(
bool from_allow_to_disallow; bool from_allow_to_disallow;
std::tie(is_cross_origin, from_allow_to_disallow) = GetParam(); 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 = SandboxOption initial_sandbox_option =
from_allow_to_disallow ? SandboxOption::kAllowDownloads from_allow_to_disallow ? SandboxOption::kAllowDownloads
: SandboxOption::kDisallowDownloads; : SandboxOption::kDisallowDownloads;
...@@ -741,7 +739,7 @@ IN_PROC_BROWSER_TEST_P( ...@@ -741,7 +739,7 @@ IN_PROC_BROWSER_TEST_P(
: kSandboxTokensAllowDownloads; : kSandboxTokensAllowDownloads;
InitializeHistogramTesterAndWebFeatureWaiter(); InitializeHistogramTesterAndWebFeatureWaiter();
SetNumDownloadsExpectation(1); SetNumDownloadsExpectation(number_of_downloads);
InitializeOneSubframeSetup(initial_sandbox_option, false /* is_ad_frame */, InitializeOneSubframeSetup(initial_sandbox_option, false /* is_ad_frame */,
is_cross_origin); is_cross_origin);
...@@ -769,16 +767,14 @@ IN_PROC_BROWSER_TEST_P( ...@@ -769,16 +767,14 @@ IN_PROC_BROWSER_TEST_P(
// Test that when the iframe sandbox attribute is updated before navigation, // Test that when the iframe sandbox attribute is updated before navigation,
// the updated flag will NOT be controlling the navigation-initiator frame's // the updated flag will NOT be controlling the navigation-initiator frame's
// policy for the download intervention. Given that the feature is disabled by // policy for the download intervention.
// 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.
IN_PROC_BROWSER_TEST_P(DownloadFramePolicyBrowserTest_UpdateIframeSandboxFlags, IN_PROC_BROWSER_TEST_P(DownloadFramePolicyBrowserTest_UpdateIframeSandboxFlags,
EffectiveSandboxPolicyUsedForNavigationInitiatorFrame) { EffectiveSandboxPolicyUsedForNavigationInitiatorFrame) {
bool is_cross_origin; bool is_cross_origin;
bool from_allow_to_disallow; bool from_allow_to_disallow;
std::tie(is_cross_origin, from_allow_to_disallow) = GetParam(); 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 = SandboxOption initial_sandbox_option =
from_allow_to_disallow ? SandboxOption::kAllowDownloads from_allow_to_disallow ? SandboxOption::kAllowDownloads
: SandboxOption::kDisallowDownloads; : SandboxOption::kDisallowDownloads;
...@@ -788,7 +784,7 @@ IN_PROC_BROWSER_TEST_P(DownloadFramePolicyBrowserTest_UpdateIframeSandboxFlags, ...@@ -788,7 +784,7 @@ IN_PROC_BROWSER_TEST_P(DownloadFramePolicyBrowserTest_UpdateIframeSandboxFlags,
: kSandboxTokensAllowDownloads; : kSandboxTokensAllowDownloads;
InitializeHistogramTesterAndWebFeatureWaiter(); InitializeHistogramTesterAndWebFeatureWaiter();
SetNumDownloadsExpectation(1); SetNumDownloadsExpectation(number_of_downloads);
InitializeOneSubframeSetup(initial_sandbox_option, false /* is_ad_frame */, InitializeOneSubframeSetup(initial_sandbox_option, false /* is_ad_frame */,
is_cross_origin); is_cross_origin);
......
...@@ -60,10 +60,9 @@ void PossiblyWarnFeatureDeprecation(content::RenderFrameHost* rfh, ...@@ -60,10 +60,9 @@ void PossiblyWarnFeatureDeprecation(content::RenderFrameHost* rfh,
case WebFeature::kDownloadInSandbox: case WebFeature::kDownloadInSandbox:
rfh->AddMessageToConsole( rfh->AddMessageToConsole(
blink::mojom::ConsoleMessageLevel::kWarning, blink::mojom::ConsoleMessageLevel::kWarning,
"[Deprecation] Download in sandbox is deprecated and will be removed " "Download is disallowed. The frame initiating or instantiating the "
"in M81. You may consider adding 'allow-downloads' to the sandbox " "download is sandboxed, but the flag ‘allow-downloads’ is not set. "
"attribute list. See " "See https://www.chromestatus.com/feature/5706745674465280 for more "
"https://www.chromestatus.com/feature/5706745674465280 for more "
"details."); "details.");
return; return;
case WebFeature::kDownloadInAdFrameWithoutUserGesture: case WebFeature::kDownloadInAdFrameWithoutUserGesture:
......
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
}, },
{ {
name: "BlockingDownloadsInSandbox", name: "BlockingDownloadsInSandbox",
status: "test", status: "stable",
}, },
{ {
name: "BlockingFocusWithoutUserActivation", 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