Skip to content

Commit

Permalink
Add use-counter for http refresh when scripting is disabled.
Browse files Browse the repository at this point in the history
This CL tracks usage of http refresh when scripting is disabled. It is
meant to gauge how many websites would break if we were to block http
refresh when user disabled Javascript. The goal would be to help
accessibility tools being confused by continual reloads.

Test: Go to https://meta-http-equiv-refresh.glitch.me/ and check
chrome://histograms/UseCounter.Features

HTML Spec PR: whatwg/html#7203

Change-Id: I2961a5ca05f4d2348e712673bb7686ea63b349b5
Bug: 63107
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3231179
Reviewed-by: Mike West <mkwst@chromium.org>
Commit-Queue: François Beaufort <beaufort.francois@gmail.com>
Cr-Commit-Position: refs/heads/main@{#933377}
NOKEYCHECK=True
GitOrigin-RevId: 32c6f34e902866e29b0a242ca8a095c5663d6fbd
  • Loading branch information
beaufortfrancois authored and Copybara-Service committed Oct 20, 2021
1 parent aee7c1e commit 2fe9def
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions blink/public/mojom/web_feature/web_feature.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -3369,6 +3369,7 @@ enum WebFeature {
kWebAssemblyDynamicTiering = 4059,
kReadOrWriteWebDatabase = 4061,
kAutoDarkMode = 4062,
kHttpRefreshWhenScriptingDisabled = 4063,

// Add new features immediately above this line. Don't change assigned
// numbers of any item, and don't reuse removed slots.
Expand Down
6 changes: 6 additions & 0 deletions blink/renderer/core/dom/document.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4260,6 +4260,12 @@ void Document::MaybeHandleHttpRefresh(const String& content,
mojom::ConsoleMessageLevel::kError, message));
return;
}

// Monitor blocking refresh usage when scripting is disabled.
// See https://crbug.com/63107
if (!dom_window_->CanExecuteScripts(kNotAboutToExecuteScript))
UseCounter::Count(this, WebFeature::kHttpRefreshWhenScriptingDisabled);

if (http_refresh_type == kHttpRefreshFromHeader) {
UseCounter::Count(this, WebFeature::kRefreshHeader);
}
Expand Down

0 comments on commit 2fe9def

Please sign in to comment.