diff --git a/build/bromite_patches_list.txt b/build/bromite_patches_list.txt index 2aef5ca4..7c37fb9f 100644 --- a/build/bromite_patches_list.txt +++ b/build/bromite_patches_list.txt @@ -274,4 +274,8 @@ AudioBuffer-AnalyserNode-fp-mitigations.patch 00Remove-detection-of-captive-portals.patch 00Disable-SHA1-Server-Signature.patch 00Remove-auth-header-upon-cross-origin-redirect.patch -00Clear-CORS-Preflight-Cache-on-clearing-data.patch \ No newline at end of file +00Clear-CORS-Preflight-Cache-on-clearing-data.patch +00Multi-Screen-Window-Placement-API-fix.patch +00Disable-speechSynthesis-getVoices-API.patch +00Remove-https-connection-from-chrome-discards.patch +00Add-a-flag-to-disable-GamePad-API.patch \ No newline at end of file diff --git a/build/patches/00Add-a-flag-to-disable-GamePad-API.patch b/build/patches/00Add-a-flag-to-disable-GamePad-API.patch new file mode 100644 index 00000000..8dca3069 --- /dev/null +++ b/build/patches/00Add-a-flag-to-disable-GamePad-API.patch @@ -0,0 +1,76 @@ +From: uazo +Date: Fri, 21 Apr 2023 13:10:20 +0000 +Subject: Add a flag to disable GamePad API + +Adds restrict-gamepad-access flag (default active) to disable GamePad API. +--- + chrome/browser/flag-metadata.json | 4 ++-- + chrome/browser/flag_descriptions.cc | 2 +- + device/gamepad/public/cpp/gamepad_features.cc | 2 +- + .../blink/renderer/modules/gamepad/navigator_gamepad.cc | 6 ++++++ + 4 files changed, 10 insertions(+), 4 deletions(-) + +diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json +--- a/chrome/browser/flag-metadata.json ++++ b/chrome/browser/flag-metadata.json +@@ -6235,9 +6235,9 @@ + "expiry_milestone": 120 + }, + { +- "name": "restrict-gamepad-access", ++ "name": "restrict-gamepad-access", // restrict-gamepad-access" + "owners": [ "//device/gamepad/OWNERS", "jameshollyer@chromium.org" ], +- "expiry_milestone": 96 ++ "expiry_milestone": -1 + }, + { + "name": "revamped-password-management-bubble", +diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc +--- a/chrome/browser/flag_descriptions.cc ++++ b/chrome/browser/flag_descriptions.cc +@@ -2708,7 +2708,7 @@ const char kReduceUserAgentDescription[] = + + const char kRestrictGamepadAccessName[] = "Restrict gamepad access"; + const char kRestrictGamepadAccessDescription[] = +- "Enables Permissions Policy and Secure Context restrictions on the Gamepad " ++ "Disable the Gamepad " + "API"; + + const char kRoundedDisplay[] = "Rounded display"; +diff --git a/device/gamepad/public/cpp/gamepad_features.cc b/device/gamepad/public/cpp/gamepad_features.cc +--- a/device/gamepad/public/cpp/gamepad_features.cc ++++ b/device/gamepad/public/cpp/gamepad_features.cc +@@ -28,7 +28,7 @@ BASE_FEATURE(kEnableWindowsGamingInputDataFetcher, + + BASE_FEATURE(kRestrictGamepadAccess, + "RestrictGamepadAccess", +- base::FEATURE_DISABLED_BY_DEFAULT); ++ base::FEATURE_ENABLED_BY_DEFAULT); + + #if BUILDFLAG(IS_ANDROID) + // Enables gamepad vibration on Android 12+. +diff --git a/third_party/blink/renderer/modules/gamepad/navigator_gamepad.cc b/third_party/blink/renderer/modules/gamepad/navigator_gamepad.cc +--- a/third_party/blink/renderer/modules/gamepad/navigator_gamepad.cc ++++ b/third_party/blink/renderer/modules/gamepad/navigator_gamepad.cc +@@ -113,6 +113,10 @@ void RecordGamepadsForIdentifiabilityStudy( + HeapVector> NavigatorGamepad::getGamepads( + Navigator& navigator, + ExceptionState& exception_state) { ++ if (base::FeatureList::IsEnabled(::features::kRestrictGamepadAccess)) { ++ exception_state.ThrowSecurityError("Access to the feature \"gamepad\" is denied"); ++ return HeapVector>(); ++ } + if (!navigator.DomWindow()) { + // Using an existing NavigatorGamepad if one exists, but don't create one + // for a detached window, as its subclasses depend on a non-null window. +@@ -405,6 +409,8 @@ void NavigatorGamepad::SampleAndCompareGamepadState() { + + void NavigatorGamepad::DispatchGamepadEvent(const AtomicString& event_name, + Gamepad* gamepad) { ++ if (base::FeatureList::IsEnabled(::features::kRestrictGamepadAccess)) ++ return; + // Ensure that we're blocking re-entrancy. + DCHECK(processing_events_); + DCHECK(has_connection_event_listener_); +-- +2.25.1 diff --git a/build/patches/00Disable-speechSynthesis-getVoices-API.patch b/build/patches/00Disable-speechSynthesis-getVoices-API.patch new file mode 100644 index 00000000..019e195b --- /dev/null +++ b/build/patches/00Disable-speechSynthesis-getVoices-API.patch @@ -0,0 +1,147 @@ +From: uazo +Date: Thu, 20 Apr 2023 15:03:13 +0000 +Subject: Disable speechSynthesis getVoices API + +Adds flag disable-speechsynthesis-voice-list to disable +SpeechSynthesis.getVoices() call. +If not active the user must also set the system timezone override +to enable it. +--- + chrome/browser/about_flags.cc | 5 +++++ + .../renderer/content_settings_agent_impl.cc | 11 ++++++++++- + .../renderer/content_settings_agent_impl.h | 2 ++ + third_party/blink/common/features.cc | 4 ++++ + third_party/blink/public/common/features.h | 2 ++ + .../platform/web_content_settings_client.h | 2 ++ + .../renderer/modules/speech/speech_synthesis.cc | 17 ++++++++++++++--- + 7 files changed, 39 insertions(+), 4 deletions(-) + +diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc +--- a/chrome/browser/about_flags.cc ++++ b/chrome/browser/about_flags.cc +@@ -6670,6 +6670,11 @@ const FeatureEntry kFeatureEntries[] = { + flag_descriptions::kFileHandlingIconsDescription, kOsDesktop, + FEATURE_VALUE_TYPE(blink::features::kFileHandlingIcons)}, + ++ {"disable-speechsynthesis-voice-list", ++ "Disable speechSynthesis.getVoices()", ++ "Disables access to the list of items installed on the device", kOsAll, ++ FEATURE_VALUE_TYPE(blink::features::kDisableSpeechSynthesisVoiceList)}, ++ + {"strict-origin-isolation", flag_descriptions::kStrictOriginIsolationName, + flag_descriptions::kStrictOriginIsolationDescription, kOsAll, + FEATURE_VALUE_TYPE(features::kStrictOriginIsolation)}, +diff --git a/components/content_settings/renderer/content_settings_agent_impl.cc b/components/content_settings/renderer/content_settings_agent_impl.cc +--- a/components/content_settings/renderer/content_settings_agent_impl.cc ++++ b/components/content_settings/renderer/content_settings_agent_impl.cc +@@ -501,6 +501,16 @@ bool ContentSettingsAgentImpl::IsAllowlistedForContentSettings() const { + return false; + } + ++bool ContentSettingsAgentImpl::IsTimezoneChanged() { ++ if (!content_setting_rules_) ++ return false; ++ blink::WebLocalFrame* frame = render_frame()->GetWebFrame(); ++ // CONTENT_SETTING_ALLOW = use system time ++ return CONTENT_SETTING_ALLOW != GetContentSettingFromRules( ++ content_setting_rules_->timezone_override_rules, ++ url::Origin(frame->GetDocument().GetSecurityOrigin()).GetURL()); ++} ++ + bool ContentSettingsAgentImpl::UpdateOverrides() { + // Evaluate the content setting rules + ContentSetting setting = CONTENT_SETTING_ALLOW; +@@ -514,7 +524,6 @@ bool ContentSettingsAgentImpl::UpdateOverrides() { + } + return UpdateTimeZoneOverride( + setting, content_setting_rules_->timezone_override_value); +- //&& UpdateLocaleOverride(setting); + } + + bool ContentSettingsAgentImpl::UpdateTimeZoneOverride( +diff --git a/components/content_settings/renderer/content_settings_agent_impl.h b/components/content_settings/renderer/content_settings_agent_impl.h +--- a/components/content_settings/renderer/content_settings_agent_impl.h ++++ b/components/content_settings/renderer/content_settings_agent_impl.h +@@ -116,6 +116,8 @@ class ContentSettingsAgentImpl + void SetRendererContentSettingRulesForTest( + const RendererContentSettingRules& rules); + ++ bool IsTimezoneChanged() override; ++ + protected: + // Allow this to be overridden by tests. + virtual void BindContentSettingsManager( +diff --git a/third_party/blink/common/features.cc b/third_party/blink/common/features.cc +--- a/third_party/blink/common/features.cc ++++ b/third_party/blink/common/features.cc +@@ -1558,6 +1558,10 @@ BASE_FEATURE(kStylusPointerAdjustment, + "StylusPointerAdjustment", + base::FEATURE_DISABLED_BY_DEFAULT); + ++BASE_FEATURE(kDisableSpeechSynthesisVoiceList, ++ "DisableSpeechSynthesisVoiceList", ++ base::FEATURE_ENABLED_BY_DEFAULT); ++ + BASE_FEATURE(kDisableArrayBufferSizeLimitsForTesting, + "DisableArrayBufferSizeLimitsForTesting", + base::FEATURE_DISABLED_BY_DEFAULT); +diff --git a/third_party/blink/public/common/features.h b/third_party/blink/public/common/features.h +--- a/third_party/blink/public/common/features.h ++++ b/third_party/blink/public/common/features.h +@@ -771,6 +771,8 @@ BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kAndroidExtendedEditingCommands); + // enabling functions like writing into a nearby input element. + BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kStylusPointerAdjustment); + ++BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kDisableSpeechSynthesisVoiceList); ++ + // TODO(https://crbug.com/1201109): temporary flag to disable new ArrayBuffer + // size limits, so that tests can be written against code receiving these + // buffers. Remove when the bindings code instituting these limits is removed. +diff --git a/third_party/blink/public/platform/web_content_settings_client.h b/third_party/blink/public/platform/web_content_settings_client.h +--- a/third_party/blink/public/platform/web_content_settings_client.h ++++ b/third_party/blink/public/platform/web_content_settings_client.h +@@ -123,6 +123,8 @@ class WebContentSettingsClient { + // frame. + virtual bool ShouldAutoupgradeMixedContent() { return true; } + ++ virtual bool IsTimezoneChanged() { return false; } ++ + // Controls whether the ViewTransition callback needs to be larger than + // default. + virtual bool IncreaseViewTransitionCallbackTimeout() const { return false; } +diff --git a/third_party/blink/renderer/modules/speech/speech_synthesis.cc b/third_party/blink/renderer/modules/speech/speech_synthesis.cc +--- a/third_party/blink/renderer/modules/speech/speech_synthesis.cc ++++ b/third_party/blink/renderer/modules/speech/speech_synthesis.cc +@@ -35,6 +35,7 @@ + #include "third_party/blink/public/common/privacy_budget/identifiable_token_builder.h" + #include "third_party/blink/public/common/thread_safe_browser_interface_broker_proxy.h" + #include "third_party/blink/public/platform/platform.h" ++#include "third_party/blink/public/platform/web_content_settings_client.h" + #include "third_party/blink/renderer/bindings/modules/v8/v8_speech_synthesis_error_event_init.h" + #include "third_party/blink/renderer/bindings/modules/v8/v8_speech_synthesis_event_init.h" + #include "third_party/blink/renderer/core/dom/document.h" +@@ -93,9 +94,19 @@ SpeechSynthesis::SpeechSynthesis(LocalDOMWindow& window) + void SpeechSynthesis::OnSetVoiceList( + Vector mojom_voices) { + voice_list_.clear(); +- for (auto& mojom_voice : mojom_voices) { +- voice_list_.push_back( +- MakeGarbageCollected(std::move(mojom_voice))); ++ bool allowed = !base::FeatureList::IsEnabled(features::kDisableSpeechSynthesisVoiceList); ++ if (allowed) { ++ auto* frame = GetSupplementable()->GetFrame(); ++ if (frame) { ++ blink::WebContentSettingsClient* settings = frame->GetContentSettingsClient(); ++ if (settings) allowed = !settings->IsTimezoneChanged(); ++ } ++ } ++ if (allowed) { ++ for (auto& mojom_voice : mojom_voices) { ++ voice_list_.push_back( ++ MakeGarbageCollected(std::move(mojom_voice))); ++ } + } + VoicesDidChange(); + } +-- +2.25.1 diff --git a/build/patches/00Multi-Screen-Window-Placement-API-fix.patch b/build/patches/00Multi-Screen-Window-Placement-API-fix.patch new file mode 100644 index 00000000..ebeaf2cd --- /dev/null +++ b/build/patches/00Multi-Screen-Window-Placement-API-fix.patch @@ -0,0 +1,94 @@ +From: uazo +Date: Thu, 20 Apr 2023 07:45:37 +0000 +Subject: Multi-Screen Window Placement API fix + +Links the use of screen.isExtended to WINDOW_MANAGEMENT permission +granted by user +--- + .../blink/renderer/core/frame/screen.cc | 25 +++++++++++++++++-- + .../blink/renderer/core/frame/screen.h | 8 ++++++ + 2 files changed, 31 insertions(+), 2 deletions(-) + +diff --git a/third_party/blink/renderer/core/frame/screen.cc b/third_party/blink/renderer/core/frame/screen.cc +--- a/third_party/blink/renderer/core/frame/screen.cc ++++ b/third_party/blink/renderer/core/frame/screen.cc +@@ -35,6 +35,7 @@ + #include "third_party/blink/renderer/core/frame/local_frame.h" + #include "third_party/blink/renderer/core/frame/settings.h" + #include "third_party/blink/renderer/core/page/chrome_client.h" ++#include "third_party/blink/renderer/modules/permissions/permission_utils.h" + #include "ui/display/screen_info.h" + #include "ui/display/screen_infos.h" + +@@ -49,7 +50,26 @@ Screen::Screen(LocalDOMWindow* window, + bool use_size_override) + : ExecutionContextClient(window), + display_id_(display_id), +- use_size_override_(use_size_override) {} ++ use_size_override_(use_size_override), ++ permission_service_(window) { ++ if (!permission_service_.is_bound()) { ++ ConnectToPermissionService( ++ window, permission_service_.BindNewPipeAndPassReceiver( ++ window->GetTaskRunner(TaskType::kMiscPlatformAPI))); ++ } ++ ++ permission_service_->HasPermission( ++ CreatePermissionDescriptor(mojom::blink::PermissionName::WINDOW_MANAGEMENT), ++ WTF::BindOnce(&Screen::DidGetPermissionState, ++ WrapPersistent(this))); ++} ++ ++void Screen::DidGetPermissionState( ++ mojom::blink::PermissionStatus status) { ++ has_permission_ = ++ status == mojom::blink::PermissionStatus::GRANTED; ++ permission_service_.reset(); ++} + + // static + bool Screen::AreWebExposedScreenPropertiesEqual( +@@ -159,6 +179,7 @@ int Screen::availWidth() const { + } + + void Screen::Trace(Visitor* visitor) const { ++ visitor->Trace(permission_service_); + EventTargetWithInlineData::Trace(visitor); + ExecutionContextClient::Trace(visitor); + Supplementable::Trace(visitor); +@@ -181,7 +202,7 @@ bool Screen::isExtended() const { + return false; + } + +- return GetScreenInfo().is_extended; ++ return GetScreenInfo().is_extended && has_permission_; + } + + gfx::Rect Screen::GetRect(bool available) const { +diff --git a/third_party/blink/renderer/core/frame/screen.h b/third_party/blink/renderer/core/frame/screen.h +--- a/third_party/blink/renderer/core/frame/screen.h ++++ b/third_party/blink/renderer/core/frame/screen.h +@@ -33,6 +33,8 @@ + #include "third_party/blink/renderer/core/dom/events/event_target.h" + #include "third_party/blink/renderer/core/execution_context/execution_context_lifecycle_observer.h" + #include "third_party/blink/renderer/platform/heap/garbage_collected.h" ++#include "third_party/blink/public/mojom/permissions/permission.mojom-blink.h" ++#include "third_party/blink/renderer/platform/mojo/heap_mojo_remote.h" + #include "third_party/blink/renderer/platform/supplementable.h" + #include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" + #include "ui/gfx/geometry/rect.h" +@@ -99,6 +101,12 @@ class CORE_EXPORT Screen : public EventTargetWithInlineData, + // dimensions match window.innerWidth/innerHeight while a page is fullscreen, + // but that is not always true. crbug.com/1367416 + const bool use_size_override_; ++ ++ private: ++ void DidGetPermissionState(mojom::blink::PermissionStatus status); ++ ++ bool has_permission_ = false; ++ HeapMojoRemote permission_service_; + }; + + } // namespace blink +-- +2.25.1 diff --git a/build/patches/00Remove-https-connection-from-chrome-discards.patch b/build/patches/00Remove-https-connection-from-chrome-discards.patch new file mode 100644 index 00000000..af9ebacb --- /dev/null +++ b/build/patches/00Remove-https-connection-from-chrome-discards.patch @@ -0,0 +1,24 @@ +From: uazo +Date: Thu, 20 Apr 2023 15:03:56 +0000 +Subject: Remove https connection from chrome://discards + +--- + chrome/browser/resources/discards/graph_doc_template.html | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/chrome/browser/resources/discards/graph_doc_template.html b/chrome/browser/resources/discards/graph_doc_template.html +--- a/chrome/browser/resources/discards/graph_doc_template.html ++++ b/chrome/browser/resources/discards/graph_doc_template.html +@@ -78,10 +78,6 @@ URL. As result, this document needs to be self-contained, hence inline scripts. + } + + +- + +-- +2.25.1