diff --git a/build/bromite_patches_list.txt b/build/bromite_patches_list.txt index e7f4a767..13c0de48 100644 --- a/build/bromite_patches_list.txt +++ b/build/bromite_patches_list.txt @@ -243,4 +243,10 @@ Fix-WebWorker-requestAnimationFrame.patch 00Logcat-crash-reports-UI--win-fixup-.patch 00Fix-windows-build.patch 00ungoogled-chr-no-special-hosts-domains--add-fixup-.patch -00Disable-fetching-of-all-field-trials--add-fixup-.patch \ No newline at end of file +00Disable-fetching-of-all-field-trials--add-fixup-.patch +00Add-an-always-incognito-mode--add-fixup-.patch +00Move-navigation-bar-to-bottom--add-fixup-.patch +00Add-menu-item-to-view-source--add-fixup-.patch +00Add-AudioContextAPI-flags.patch +00Client-hints-overrides--add-fixup-.patch +00Disable-Component-Updates.patch \ No newline at end of file diff --git a/build/patches/00Add-AudioContextAPI-flags.patch b/build/patches/00Add-AudioContextAPI-flags.patch new file mode 100644 index 00000000..4db06df2 --- /dev/null +++ b/build/patches/00Add-AudioContextAPI-flags.patch @@ -0,0 +1,540 @@ +From: Your Name +Date: Mon, 7 Nov 2022 16:45:13 +0000 +Subject: Add AudioContextAPI flags + +--- + chrome/browser/about_flags.cc | 8 ++++ + chrome/browser/flag_descriptions.cc | 9 ++++ + chrome/browser/flag_descriptions.h | 5 +++ + third_party/blink/common/features.cc | 5 +++ + third_party/blink/public/common/features.h | 3 ++ + .../modules/webaudio/analyser_handler.h | 16 +++---- + .../modules/webaudio/analyser_node.cc | 20 +++++---- + .../renderer/modules/webaudio/analyser_node.h | 8 ++-- + .../modules/webaudio/analyser_node.idl | 8 ++-- + .../renderer/modules/webaudio/audio_buffer.cc | 34 ++++++++++++-- + .../renderer/modules/webaudio/audio_buffer.h | 7 +-- + .../modules/webaudio/audio_buffer.idl | 6 +++ + .../modules/webaudio/audio_context.cc | 5 +++ + .../modules/webaudio/base_audio_context.cc | 12 +++++ + .../modules/webaudio/base_audio_context.h | 2 + + .../modules/webaudio/realtime_analyser.cc | 44 +++++++++++++++++-- + .../modules/webaudio/realtime_analyser.h | 10 +++-- + 17 files changed, 163 insertions(+), 39 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 +@@ -3567,6 +3567,14 @@ const FeatureEntry kFeatureEntries[] = { + flag_descriptions::kKioskEnableAppServiceDescription, kOsCrOS, + FEATURE_VALUE_TYPE(features::kKioskEnableAppService)}, + #endif // BUILDFLAG(IS_CHROMEOS) ++ {"audio-context-api", ++ flag_descriptions::kAudioContextAPIEnabledName, ++ flag_descriptions::kAudioContextAPIEnabledDescription, kOsAll, ++ FEATURE_VALUE_TYPE(blink::features::kAudioContextAPIEnabled)}, ++ {"fingerprinting-audio-context-data-noise", ++ flag_descriptions::kAudioContextShuffleEnabledName, ++ flag_descriptions::kAudioContextShuffleEnabledDescription, kOsAll, ++ FEATURE_VALUE_TYPE(blink::features::kAudioContextShuffleEnabled)}, + #if !BUILDFLAG(IS_ANDROID) + {"enable-webrtc-remote-event-log", + flag_descriptions::kWebRtcRemoteEventLogName, +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 +@@ -3217,6 +3217,15 @@ const char kWebrtcUseMinMaxVEADimensionsDescription[] = + "When enabled, WebRTC will only use the Video Encode Accelerator for " + "video resolutions inside those published as supported."; + ++const char kAudioContextAPIEnabledName[] = ++ "Audio Context API"; ++const char kAudioContextAPIEnabledDescription[] = ++ "When enabled, api are available for the audio context."; ++const char kAudioContextShuffleEnabledName[] = ++ "Enable Audio Context fingerprint deception"; ++const char kAudioContextShuffleEnabledDescription[] = ++ "Scale the output values of xxx with a randomly selected factor."; ++ + const char kWebUsbDeviceDetectionName[] = + "Automatic detection of WebUSB-compatible devices"; + const char kWebUsbDeviceDetectionDescription[] = +diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h +--- a/chrome/browser/flag_descriptions.h ++++ b/chrome/browser/flag_descriptions.h +@@ -1824,6 +1824,11 @@ extern const char kWebrtcSrtpAesGcmDescription[]; + extern const char kWebrtcUseMinMaxVEADimensionsName[]; + extern const char kWebrtcUseMinMaxVEADimensionsDescription[]; + ++extern const char kAudioContextAPIEnabledName[]; ++extern const char kAudioContextAPIEnabledDescription[]; ++extern const char kAudioContextShuffleEnabledName[]; ++extern const char kAudioContextShuffleEnabledDescription[]; ++ + extern const char kWebUsbDeviceDetectionName[]; + extern const char kWebUsbDeviceDetectionDescription[]; + +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 +@@ -565,6 +565,11 @@ const base::Feature kWebRtcUseMinMaxVEADimensions { + #endif + }; + ++const base::Feature kAudioContextAPIEnabled { ++ "AudioContextAPIEnabled", base::FEATURE_ENABLED_BY_DEFAULT}; ++const base::Feature kAudioContextShuffleEnabled { ++ "AudioContextShuffleEnabled", base::FEATURE_ENABLED_BY_DEFAULT}; ++ + // Blink garbage collection. + // Enables compaction of backing stores on Blink's heap. + const base::Feature kBlinkHeapCompaction{"BlinkHeapCompaction", +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 +@@ -257,6 +257,9 @@ BLINK_COMMON_EXPORT bool IsPlzDedicatedWorkerEnabled(); + + BLINK_COMMON_EXPORT extern const base::Feature kWebRtcUseMinMaxVEADimensions; + ++BLINK_COMMON_EXPORT extern const base::Feature kAudioContextAPIEnabled; ++BLINK_COMMON_EXPORT extern const base::Feature kAudioContextShuffleEnabled; ++ + // Blink garbage collection. + BLINK_COMMON_EXPORT extern const base::Feature kBlinkHeapCompaction; + BLINK_COMMON_EXPORT extern const base::Feature kBlinkHeapConcurrentMarking; +diff --git a/third_party/blink/renderer/modules/webaudio/analyser_handler.h b/third_party/blink/renderer/modules/webaudio/analyser_handler.h +--- a/third_party/blink/renderer/modules/webaudio/analyser_handler.h ++++ b/third_party/blink/renderer/modules/webaudio/analyser_handler.h +@@ -40,17 +40,17 @@ class AnalyserHandler final : public AudioBasicInspectorHandler { + return analyser_.SmoothingTimeConstant(); + } + +- void GetFloatFrequencyData(DOMFloat32Array* array, double current_time) { +- analyser_.GetFloatFrequencyData(array, current_time); ++ void GetFloatFrequencyData(DOMFloat32Array* array, double current_time, ExceptionState& exception_state) { ++ analyser_.GetFloatFrequencyData(array, current_time, exception_state); + } +- void GetByteFrequencyData(DOMUint8Array* array, double current_time) { +- analyser_.GetByteFrequencyData(array, current_time); ++ void GetByteFrequencyData(DOMUint8Array* array, double current_time, ExceptionState& exception_state) { ++ analyser_.GetByteFrequencyData(array, current_time, exception_state); + } +- void GetFloatTimeDomainData(DOMFloat32Array* array) { +- analyser_.GetFloatTimeDomainData(array); ++ void GetFloatTimeDomainData(DOMFloat32Array* array, ExceptionState& exception_state) { ++ analyser_.GetFloatTimeDomainData(array, exception_state); + } +- void GetByteTimeDomainData(DOMUint8Array* array) { +- analyser_.GetByteTimeDomainData(array); ++ void GetByteTimeDomainData(DOMUint8Array* array, ExceptionState& exception_state) { ++ analyser_.GetByteTimeDomainData(array, exception_state); + } + + // AnalyserNode needs special handling when updating the pull status +diff --git a/third_party/blink/renderer/modules/webaudio/analyser_node.cc b/third_party/blink/renderer/modules/webaudio/analyser_node.cc +--- a/third_party/blink/renderer/modules/webaudio/analyser_node.cc ++++ b/third_party/blink/renderer/modules/webaudio/analyser_node.cc +@@ -117,22 +117,26 @@ double AnalyserNode::smoothingTimeConstant() const { + return GetAnalyserHandler().SmoothingTimeConstant(); + } + +-void AnalyserNode::getFloatFrequencyData(NotShared array) { ++void AnalyserNode::getFloatFrequencyData(NotShared array, ++ ExceptionState& exception_state) { + GetAnalyserHandler().GetFloatFrequencyData(array.Get(), +- context()->currentTime()); ++ context()->currentTime(), exception_state); + } + +-void AnalyserNode::getByteFrequencyData(NotShared array) { ++void AnalyserNode::getByteFrequencyData(NotShared array, ++ ExceptionState& exception_state) { + GetAnalyserHandler().GetByteFrequencyData(array.Get(), +- context()->currentTime()); ++ context()->currentTime(), exception_state); + } + +-void AnalyserNode::getFloatTimeDomainData(NotShared array) { +- GetAnalyserHandler().GetFloatTimeDomainData(array.Get()); ++void AnalyserNode::getFloatTimeDomainData(NotShared array, ++ ExceptionState& exception_state) { ++ GetAnalyserHandler().GetFloatTimeDomainData(array.Get(), exception_state); + } + +-void AnalyserNode::getByteTimeDomainData(NotShared array) { +- GetAnalyserHandler().GetByteTimeDomainData(array.Get()); ++void AnalyserNode::getByteTimeDomainData(NotShared array, ++ ExceptionState& exception_state) { ++ GetAnalyserHandler().GetByteTimeDomainData(array.Get(), exception_state); + } + + void AnalyserNode::ReportDidCreate() { +diff --git a/third_party/blink/renderer/modules/webaudio/analyser_node.h b/third_party/blink/renderer/modules/webaudio/analyser_node.h +--- a/third_party/blink/renderer/modules/webaudio/analyser_node.h ++++ b/third_party/blink/renderer/modules/webaudio/analyser_node.h +@@ -57,10 +57,10 @@ class AnalyserNode final : public AudioBasicInspectorNode { + double maxDecibels() const; + void setSmoothingTimeConstant(double, ExceptionState&); + double smoothingTimeConstant() const; +- void getFloatFrequencyData(NotShared); +- void getByteFrequencyData(NotShared); +- void getFloatTimeDomainData(NotShared); +- void getByteTimeDomainData(NotShared); ++ void getFloatFrequencyData(NotShared, ExceptionState&); ++ void getByteFrequencyData(NotShared, ExceptionState&); ++ void getFloatTimeDomainData(NotShared, ExceptionState&); ++ void getByteTimeDomainData(NotShared, ExceptionState&); + + // InspectorHelperMixin + void ReportDidCreate() final; +diff --git a/third_party/blink/renderer/modules/webaudio/analyser_node.idl b/third_party/blink/renderer/modules/webaudio/analyser_node.idl +--- a/third_party/blink/renderer/modules/webaudio/analyser_node.idl ++++ b/third_party/blink/renderer/modules/webaudio/analyser_node.idl +@@ -40,10 +40,10 @@ + + // Copies the current frequency data into the passed array. + // If the array has fewer elements than the frequencyBinCount, the excess elements will be dropped. +- //[HighEntropy, Measure] void getFloatFrequencyData(Float32Array array); +- //[HighEntropy, Measure] void getByteFrequencyData(Uint8Array array); ++ [HighEntropy, Measure, RaisesException] void getFloatFrequencyData(Float32Array array); ++ [HighEntropy, Measure, RaisesException] void getByteFrequencyData(Uint8Array array); + + // Real-time waveform data +- //[HighEntropy, Measure] void getFloatTimeDomainData(Float32Array array); +- //[HighEntropy, Measure] void getByteTimeDomainData(Uint8Array array); ++ [HighEntropy, Measure, RaisesException] void getFloatTimeDomainData(Float32Array array); ++ [HighEntropy, Measure, RaisesException] void getByteTimeDomainData(Uint8Array array); + }; +diff --git a/third_party/blink/renderer/modules/webaudio/audio_buffer.cc b/third_party/blink/renderer/modules/webaudio/audio_buffer.cc +--- a/third_party/blink/renderer/modules/webaudio/audio_buffer.cc ++++ b/third_party/blink/renderer/modules/webaudio/audio_buffer.cc +@@ -29,6 +29,7 @@ + #include "third_party/blink/renderer/modules/webaudio/audio_buffer.h" + + #include ++#include "third_party/blink/public/common/features.h" + #include "third_party/blink/renderer/bindings/modules/v8/v8_audio_buffer_options.h" + #include "third_party/blink/renderer/modules/webaudio/base_audio_context.h" + #include "third_party/blink/renderer/platform/audio/audio_bus.h" +@@ -197,8 +198,14 @@ AudioBuffer::AudioBuffer(AudioBus* bus) + } + + NotShared AudioBuffer::getChannelData( ++ ScriptState* script_state, + unsigned channel_index, + ExceptionState& exception_state) { ++ if (!base::FeatureList::IsEnabled(features::kAudioContextAPIEnabled)) { ++ exception_state.ThrowDOMException( ++ DOMExceptionCode::kNotSupportedError, "getChannelData() is unavailable"); ++ return NotShared(nullptr); ++ } + if (channel_index >= channels_.size()) { + exception_state.ThrowDOMException( + DOMExceptionCode::kIndexSizeError, +@@ -208,7 +215,16 @@ NotShared AudioBuffer::getChannelData( + return NotShared(nullptr); + } + +- return getChannelData(channel_index); ++ NotShared array = getChannelData(channel_index); ++ DOMFloat32Array* destination_array = array.Get(); ++ size_t len = destination_array->length(); ++ if (len > 0) { ++ float* destination = destination_array->Data(); ++ for (unsigned i = 0; i < len; ++i) { ++ destination[i] = BaseAudioContext::ShuffleAudioData(destination[i], i); ++ } ++ } ++ return array; + } + + NotShared AudioBuffer::getChannelData(unsigned channel_index) { +@@ -219,13 +235,20 @@ NotShared AudioBuffer::getChannelData(unsigned channel_index) { + return NotShared(channels_[channel_index].Get()); + } + +-void AudioBuffer::copyFromChannel(NotShared destination, ++void AudioBuffer::copyFromChannel(ScriptState* script_state, ++ NotShared destination, + int32_t channel_number, + ExceptionState& exception_state) { +- return copyFromChannel(destination, channel_number, 0, exception_state); ++ if (!base::FeatureList::IsEnabled(features::kAudioContextAPIEnabled)) { ++ exception_state.ThrowDOMException( ++ DOMExceptionCode::kNotSupportedError, "copyFromChannel() is unavailable"); ++ return; ++ } ++ return copyFromChannel(script_state, destination, channel_number, 0, exception_state); + } + +-void AudioBuffer::copyFromChannel(NotShared destination, ++void AudioBuffer::copyFromChannel(ScriptState* script_state, ++ NotShared destination, + int32_t channel_number, + size_t buffer_offset, + ExceptionState& exception_state) { +@@ -264,6 +287,9 @@ void AudioBuffer::copyFromChannel(NotShared destination, + DCHECK_LE(buffer_offset + count, data_length); + + memmove(dst, src + buffer_offset, count * sizeof(*src)); ++ for (unsigned i = 0; i < count; i++) { ++ dst[i] = BaseAudioContext::ShuffleAudioData(dst[i], i); ++ } + } + + void AudioBuffer::copyToChannel(NotShared source, +diff --git a/third_party/blink/renderer/modules/webaudio/audio_buffer.h b/third_party/blink/renderer/modules/webaudio/audio_buffer.h +--- a/third_party/blink/renderer/modules/webaudio/audio_buffer.h ++++ b/third_party/blink/renderer/modules/webaudio/audio_buffer.h +@@ -44,6 +44,7 @@ class AudioBus; + class AudioBufferOptions; + class ExceptionState; + class SharedAudioBuffer; ++class ScriptState; + + class MODULES_EXPORT AudioBuffer final : public ScriptWrappable { + DEFINE_WRAPPERTYPEINFO(); +@@ -88,13 +89,13 @@ class MODULES_EXPORT AudioBuffer final : public ScriptWrappable { + + // Channel data access + unsigned numberOfChannels() const { return channels_.size(); } +- NotShared getChannelData(unsigned channel_index, ++ NotShared getChannelData(ScriptState*, unsigned channel_index, + ExceptionState&); + NotShared getChannelData(unsigned channel_index); +- void copyFromChannel(NotShared, ++ void copyFromChannel(ScriptState*, NotShared, + int32_t channel_number, + ExceptionState&); +- void copyFromChannel(NotShared, ++ void copyFromChannel(ScriptState*, NotShared, + int32_t channel_number, + size_t buffer_offset, + ExceptionState&); +diff --git a/third_party/blink/renderer/modules/webaudio/audio_buffer.idl b/third_party/blink/renderer/modules/webaudio/audio_buffer.idl +--- a/third_party/blink/renderer/modules/webaudio/audio_buffer.idl ++++ b/third_party/blink/renderer/modules/webaudio/audio_buffer.idl +@@ -37,6 +37,12 @@ + + // Channel access + readonly attribute unsigned long numberOfChannels; ++ [CallWith=ScriptState, HighEntropy=Direct, Measure, RaisesException] Float32Array getChannelData( ++ unsigned long channelIndex); ++ [CallWith=ScriptState, HighEntropy, Measure, RaisesException] void copyFromChannel( ++ Float32Array destination, ++ unsigned long channelNumber, ++ optional unsigned long bufferOffset = 0); + [RaisesException] void copyToChannel( + Float32Array source, + unsigned long channelNumber, +diff --git a/third_party/blink/renderer/modules/webaudio/audio_context.cc b/third_party/blink/renderer/modules/webaudio/audio_context.cc +--- a/third_party/blink/renderer/modules/webaudio/audio_context.cc ++++ b/third_party/blink/renderer/modules/webaudio/audio_context.cc +@@ -10,6 +10,7 @@ + #include "services/metrics/public/cpp/ukm_builders.h" + #include "services/metrics/public/cpp/ukm_recorder.h" + #include "third_party/blink/public/common/browser_interface_broker_proxy.h" ++#include "third_party/blink/public/common/features.h" + #include "third_party/blink/public/platform/modules/webrtc/webrtc_logging.h" + #include "third_party/blink/public/platform/web_audio_latency_hint.h" + #include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" +@@ -507,6 +508,10 @@ double AudioContext::baseLatency() const { + DCHECK(IsMainThread()); + DCHECK(destination()); + ++ if (!base::FeatureList::IsEnabled(features::kAudioContextShuffleEnabled) && ++ !base::FeatureList::IsEnabled(features::kAudioContextAPIEnabled)) { ++ return base_latency_; ++ } + // remove precision past two decimal digits + int l = base_latency_ * 100; + return double(l)/100; +diff --git a/third_party/blink/renderer/modules/webaudio/base_audio_context.cc b/third_party/blink/renderer/modules/webaudio/base_audio_context.cc +--- a/third_party/blink/renderer/modules/webaudio/base_audio_context.cc ++++ b/third_party/blink/renderer/modules/webaudio/base_audio_context.cc +@@ -29,6 +29,7 @@ + + #include "base/metrics/histogram_functions.h" + #include "build/build_config.h" ++#include "third_party/blink/public/common/features.h" + #include "third_party/blink/public/mojom/devtools/console_message.mojom-blink.h" + #include "third_party/blink/public/mojom/frame/lifecycle.mojom-shared.h" + #include "third_party/blink/public/platform/platform.h" +@@ -701,6 +702,17 @@ Document* BaseAudioContext::GetDocument() const { + return window ? window->document() : nullptr; + } + ++/*static*/ ++float BaseAudioContext::ShuffleAudioData(float data, unsigned index) { ++ if (base::FeatureList::IsEnabled(features::kAudioContextShuffleEnabled)) { ++ float rnd = 1.0f + ++ (base::RandDouble() / 10000.0) * ++ (base::RandInt(0,10) > 5 ? 1.f : -1.f); ++ return data * rnd; ++ } ++ return data; ++} ++ + void BaseAudioContext::NotifySourceNodeStartedProcessing(AudioNode* node) { + DCHECK(IsMainThread()); + GraphAutoLocker locker(this); +diff --git a/third_party/blink/renderer/modules/webaudio/base_audio_context.h b/third_party/blink/renderer/modules/webaudio/base_audio_context.h +--- a/third_party/blink/renderer/modules/webaudio/base_audio_context.h ++++ b/third_party/blink/renderer/modules/webaudio/base_audio_context.h +@@ -338,6 +338,8 @@ class MODULES_EXPORT BaseAudioContext + // if the execution context does not exist. + bool CheckExecutionContextAndThrowIfNecessary(ExceptionState&); + ++ static float ShuffleAudioData(float data, unsigned index); ++ + protected: + enum ContextType { kRealtimeContext, kOfflineContext }; + +diff --git a/third_party/blink/renderer/modules/webaudio/realtime_analyser.cc b/third_party/blink/renderer/modules/webaudio/realtime_analyser.cc +--- a/third_party/blink/renderer/modules/webaudio/realtime_analyser.cc ++++ b/third_party/blink/renderer/modules/webaudio/realtime_analyser.cc +@@ -26,7 +26,9 @@ + #include + #include + #include ++#include "third_party/blink/public/common/features.h" + #include "third_party/blink/renderer/modules/webaudio/realtime_analyser.h" ++#include "third_party/blink/renderer/modules/webaudio/base_audio_context.h" + #include "third_party/blink/renderer/platform/audio/audio_bus.h" + #include "third_party/blink/renderer/platform/audio/audio_utilities.h" + #include "third_party/blink/renderer/platform/audio/vector_math.h" +@@ -187,15 +189,23 @@ void RealtimeAnalyser::ConvertFloatToDb(DOMFloat32Array* destination_array) { + float linear_value = source[i]; + double db_mag = audio_utilities::LinearToDecibels(linear_value); + destination[i] = static_cast(db_mag); ++ destination[i] = BaseAudioContext::ShuffleAudioData(destination[i], i); + } + } + } + + void RealtimeAnalyser::GetFloatFrequencyData(DOMFloat32Array* destination_array, +- double current_time) { ++ double current_time, ++ ExceptionState& exception_state) { + DCHECK(IsMainThread()); + DCHECK(destination_array); + ++ if (!base::FeatureList::IsEnabled(features::kAudioContextAPIEnabled)) { ++ exception_state.ThrowDOMException( ++ DOMExceptionCode::kNotSupportedError, "GetFloatFrequencyData() is unavailable"); ++ return; ++ } ++ + if (current_time <= last_analysis_time_) { + ConvertFloatToDb(destination_array); + return; +@@ -230,6 +240,8 @@ void RealtimeAnalyser::ConvertToByteData(DOMUint8Array* destination_array) { + double scaled_value = + UCHAR_MAX * (db_mag - min_decibels) * range_scale_factor; + ++ scaled_value = BaseAudioContext::ShuffleAudioData(scaled_value, i); ++ + // Clip to valid range. + if (scaled_value < 0) { + scaled_value = 0; +@@ -244,10 +256,17 @@ void RealtimeAnalyser::ConvertToByteData(DOMUint8Array* destination_array) { + } + + void RealtimeAnalyser::GetByteFrequencyData(DOMUint8Array* destination_array, +- double current_time) { ++ double current_time, ++ ExceptionState& exception_state) { + DCHECK(IsMainThread()); + DCHECK(destination_array); + ++ if (!base::FeatureList::IsEnabled(features::kAudioContextAPIEnabled)) { ++ exception_state.ThrowDOMException( ++ DOMExceptionCode::kNotSupportedError, "GetByteFrequencyData() is unavailable"); ++ return; ++ } ++ + if (current_time <= last_analysis_time_) { + // FIXME: Is it worth caching the data so we don't have to do the conversion + // every time? Perhaps not, since we expect many calls in the same +@@ -264,10 +283,17 @@ void RealtimeAnalyser::GetByteFrequencyData(DOMUint8Array* destination_array, + } + + void RealtimeAnalyser::GetFloatTimeDomainData( +- DOMFloat32Array* destination_array) { ++ DOMFloat32Array* destination_array, ++ ExceptionState& exception_state) { + DCHECK(IsMainThread()); + DCHECK(destination_array); + ++ if (!base::FeatureList::IsEnabled(features::kAudioContextAPIEnabled)) { ++ exception_state.ThrowDOMException( ++ DOMExceptionCode::kNotSupportedError, "GetFloatTimeDomainData() is unavailable"); ++ return; ++ } ++ + unsigned fft_size = FftSize(); + size_t len = + std::min(static_cast(fft_size), destination_array->length()); +@@ -286,15 +312,23 @@ void RealtimeAnalyser::GetFloatTimeDomainData( + input_buffer[(i + write_index - fft_size + kInputBufferSize) % + kInputBufferSize]; + ++ value = BaseAudioContext::ShuffleAudioData(value, i); + destination[i] = value; + } + } + } + +-void RealtimeAnalyser::GetByteTimeDomainData(DOMUint8Array* destination_array) { ++void RealtimeAnalyser::GetByteTimeDomainData(DOMUint8Array* destination_array, ++ ExceptionState& exception_state) { + DCHECK(IsMainThread()); + DCHECK(destination_array); + ++ if (!base::FeatureList::IsEnabled(features::kAudioContextAPIEnabled)) { ++ exception_state.ThrowDOMException( ++ DOMExceptionCode::kNotSupportedError, "GetByteTimeDomainData() is unavailable"); ++ return; ++ } ++ + unsigned fft_size = FftSize(); + size_t len = + std::min(static_cast(fft_size), destination_array->length()); +@@ -313,6 +347,8 @@ void RealtimeAnalyser::GetByteTimeDomainData(DOMUint8Array* destination_array) { + input_buffer[(i + write_index - fft_size + kInputBufferSize) % + kInputBufferSize]; + ++ value = BaseAudioContext::ShuffleAudioData(value, i); ++ + // Scale from nominal -1 -> +1 to unsigned byte. + double scaled_value = 128 * (value + 1); + +diff --git a/third_party/blink/renderer/modules/webaudio/realtime_analyser.h b/third_party/blink/renderer/modules/webaudio/realtime_analyser.h +--- a/third_party/blink/renderer/modules/webaudio/realtime_analyser.h ++++ b/third_party/blink/renderer/modules/webaudio/realtime_analyser.h +@@ -32,6 +32,8 @@ + #include "third_party/blink/renderer/core/typed_arrays/dom_typed_array.h" + #include "third_party/blink/renderer/platform/audio/audio_array.h" + #include "third_party/blink/renderer/platform/audio/fft_frame.h" ++#include "third_party/blink/renderer/platform/bindings/exception_messages.h" ++#include "third_party/blink/renderer/platform/bindings/exception_state.h" + + namespace blink { + +@@ -71,10 +73,10 @@ class RealtimeAnalyser final { + void SetSmoothingTimeConstant(double k) { smoothing_time_constant_ = k; } + double SmoothingTimeConstant() const { return smoothing_time_constant_; } + +- void GetFloatFrequencyData(DOMFloat32Array*, double); +- void GetByteFrequencyData(DOMUint8Array*, double); +- void GetFloatTimeDomainData(DOMFloat32Array*); +- void GetByteTimeDomainData(DOMUint8Array*); ++ void GetFloatFrequencyData(DOMFloat32Array*, double, ExceptionState&); ++ void GetByteFrequencyData(DOMUint8Array*, double, ExceptionState&); ++ void GetFloatTimeDomainData(DOMFloat32Array*, ExceptionState&); ++ void GetByteTimeDomainData(DOMUint8Array*, ExceptionState&); + + // The audio thread writes input data here. + void WriteInput(AudioBus*, uint32_t frames_to_process); +-- +2.25.1 diff --git a/build/patches/00Add-an-always-incognito-mode--add-fixup-.patch b/build/patches/00Add-an-always-incognito-mode--add-fixup-.patch new file mode 100644 index 00000000..13af5759 --- /dev/null +++ b/build/patches/00Add-an-always-incognito-mode--add-fixup-.patch @@ -0,0 +1,81 @@ +From: Your Name +Date: Mon, 7 Nov 2022 12:39:07 +0000 +Subject: Add an always-incognito mode (add fixup) + +--- + .../offline_pages/android/offline_page_bridge.cc | 16 ++++++++-------- + .../android/offline_page_model_factory.cc | 1 - + .../android/request_coordinator_factory.cc | 5 +++++ + 3 files changed, 13 insertions(+), 9 deletions(-) + +diff --git a/chrome/browser/offline_pages/android/offline_page_bridge.cc b/chrome/browser/offline_pages/android/offline_page_bridge.cc +--- a/chrome/browser/offline_pages/android/offline_page_bridge.cc ++++ b/chrome/browser/offline_pages/android/offline_page_bridge.cc +@@ -159,13 +159,7 @@ void ValidateFileCallback( + int64_t offline_id, + const GURL& url, + const base::FilePath& file_path, +- SimpleFactoryKey* key, + bool is_trusted) { +- // in always incognito, never trust input file (show file name in url) +- ProfileKey* profile_key = ProfileKey::FromSimpleFactoryKey(key); +- if(profile_key->GetPrefs()->GetBoolean(prefs::kIncognitoTabHistoryEnabled)) +- is_trusted = false; +- + // If trusted, the launch url will be the http/https url of the offline + // page. If the file path is content URI, directly open it. Otherwise, the + // launch url will be the file URL pointing to the archive file of the offline +@@ -794,9 +788,15 @@ void OfflinePageBridge::GetPageByOfflineIdDone( + } + + if (offline_page_model_->IsArchiveInInternalDir(offline_page->file_path)) { ++ bool is_trusted = true; ++ // in always incognito, never trust input file (show file name in url) ++ ProfileKey* profile_key = ProfileKey::FromSimpleFactoryKey(key_); ++ if(profile_key->GetPrefs()->GetBoolean(prefs::kIncognitoTabHistoryEnabled)) ++ is_trusted = false; ++ + ValidateFileCallback(launch_location, j_callback_obj, + offline_page->offline_id, offline_page->url, +- offline_page->file_path, key_, true /* is_trusted*/); ++ offline_page->file_path, is_trusted); + return; + } + +@@ -806,7 +806,7 @@ void OfflinePageBridge::GetPageByOfflineIdDone( + offline_page->file_size, offline_page->digest), + base::BindOnce(&ValidateFileCallback, launch_location, j_callback_obj, + offline_page->offline_id, offline_page->url, +- offline_page->file_path, key_)); ++ offline_page->file_path)); + } + + void OfflinePageBridge::GetSizeAndComputeDigestDone( +diff --git a/chrome/browser/offline_pages/android/offline_page_model_factory.cc b/chrome/browser/offline_pages/android/offline_page_model_factory.cc +--- a/chrome/browser/offline_pages/android/offline_page_model_factory.cc ++++ b/chrome/browser/offline_pages/android/offline_page_model_factory.cc +@@ -49,7 +49,6 @@ OfflinePageModel* OfflinePageModelFactory::GetForKey(SimpleFactoryKey* key) { + OfflinePageModel* OfflinePageModelFactory::GetForBrowserContext( + content::BrowserContext* browser_context) { + Profile* profile = Profile::FromBrowserContext(browser_context); +- profile = profile->GetOriginalProfile(); + return GetForKey(profile->GetProfileKey()); + } + +diff --git a/chrome/browser/offline_pages/android/request_coordinator_factory.cc b/chrome/browser/offline_pages/android/request_coordinator_factory.cc +--- a/chrome/browser/offline_pages/android/request_coordinator_factory.cc ++++ b/chrome/browser/offline_pages/android/request_coordinator_factory.cc +@@ -86,6 +86,11 @@ RequestCoordinator* RequestCoordinatorFactory::GetForBrowserContext( + + KeyedService* RequestCoordinatorFactory::BuildServiceInstanceFor( + content::BrowserContext* context) const { ++ if(context->IsOffTheRecord() && ++ Profile::FromBrowserContext(context)->GetOriginalProfile() ++ ->GetPrefs()->GetBoolean(prefs::kIncognitoTabHistoryEnabled) == false) { ++ return nullptr; ++ } + std::unique_ptr policy(new OfflinerPolicy()); + std::unique_ptr offliner; + OfflinePageModel* model = +-- +2.25.1 diff --git a/build/patches/00Add-menu-item-to-view-source--add-fixup-.patch b/build/patches/00Add-menu-item-to-view-source--add-fixup-.patch new file mode 100644 index 00000000..54b0ed7c --- /dev/null +++ b/build/patches/00Add-menu-item-to-view-source--add-fixup-.patch @@ -0,0 +1,29 @@ +From: Your Name +Date: Mon, 7 Nov 2022 16:10:21 +0000 +Subject: Add menu item to view source (add fixup) + +--- + .../app/appmenu/AppMenuPropertiesDelegateImpl.java | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/chrome/android/java/src/org/chromium/chrome/browser/app/appmenu/AppMenuPropertiesDelegateImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/app/appmenu/AppMenuPropertiesDelegateImpl.java +--- a/chrome/android/java/src/org/chromium/chrome/browser/app/appmenu/AppMenuPropertiesDelegateImpl.java ++++ b/chrome/android/java/src/org/chromium/chrome/browser/app/appmenu/AppMenuPropertiesDelegateImpl.java +@@ -1178,8 +1178,13 @@ public class AppMenuPropertiesDelegateImpl implements AppMenuPropertiesDelegate + protected void updateViewSourceMenuItem( + Menu menu, Tab currentTab) { + MenuItem viewSourceMenuItem = menu.findItem(R.id.view_source_id); +- String url = currentTab.getUrl().getSpec(); +- viewSourceMenuItem.setVisible(!url.isEmpty() && !url.startsWith("view-source:")); ++ if (currentTab != null) { ++ String url = currentTab.getUrl().getSpec(); ++ viewSourceMenuItem.setVisible(!url.isEmpty() && !url.startsWith("view-source:")); ++ } else { ++ // currentTab maybe null with start surface ++ viewSourceMenuItem.setVisible(false); ++ } + } + + /** +-- +2.25.1 diff --git a/build/patches/00Client-hints-overrides--add-fixup-.patch b/build/patches/00Client-hints-overrides--add-fixup-.patch new file mode 100644 index 00000000..4d4b45f5 --- /dev/null +++ b/build/patches/00Client-hints-overrides--add-fixup-.patch @@ -0,0 +1,21 @@ +From: Your Name +Date: Mon, 7 Nov 2022 16:49:08 +0000 +Subject: Client hints overrides (add fixup) + +--- + components/optimization_guide/core/hints_manager.cc | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/components/optimization_guide/core/hints_manager.cc b/components/optimization_guide/core/hints_manager.cc +--- a/components/optimization_guide/core/hints_manager.cc ++++ b/components/optimization_guide/core/hints_manager.cc +@@ -1065,6 +1065,7 @@ void HintsManager::CanApplyOptimizationOnDemand( + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + // TODO(crbug/1275612): Check whether we have consent to fetch. ++ if ((true)) return; // no consent on bromite + + // This set contains URLs that require some information to be fetched, whether + // that be a URL-keyed hint or a host-keyed hint. +-- +2.25.1 diff --git a/build/patches/00Disable-Component-Updates.patch b/build/patches/00Disable-Component-Updates.patch new file mode 100644 index 00000000..2ca22b00 --- /dev/null +++ b/build/patches/00Disable-Component-Updates.patch @@ -0,0 +1,46 @@ +From: Your Name +Date: Tue, 8 Nov 2022 12:41:22 +0000 +Subject: Disable Component Updates + +--- + chrome/browser/component_updater/registration.cc | 1 + + components/component_updater/component_installer.cc | 1 + + components/component_updater/component_updater_service.cc | 2 +- + 3 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/chrome/browser/component_updater/registration.cc b/chrome/browser/component_updater/registration.cc +--- a/chrome/browser/component_updater/registration.cc ++++ b/chrome/browser/component_updater/registration.cc +@@ -100,6 +100,7 @@ + namespace component_updater { + + void RegisterComponentsForUpdate() { ++ if ((true)) return; + auto* const cus = g_browser_process->component_updater(); + + #if BUILDFLAG(IS_WIN) +diff --git a/components/component_updater/component_installer.cc b/components/component_updater/component_installer.cc +--- a/components/component_updater/component_installer.cc ++++ b/components/component_updater/component_installer.cc +@@ -88,6 +88,7 @@ void ComponentInstaller::Register(ComponentUpdateService* cus, + void ComponentInstaller::Register(RegisterCallback register_callback, + base::OnceClosure callback, + base::TaskPriority task_priority) { ++ if ((true)) return; + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + + task_runner_ = base::ThreadPool::CreateSequencedTaskRunner( +diff --git a/components/component_updater/component_updater_service.cc b/components/component_updater/component_updater_service.cc +--- a/components/component_updater/component_updater_service.cc ++++ b/components/component_updater/component_updater_service.cc +@@ -501,7 +501,7 @@ std::unique_ptr ComponentUpdateServiceFactory( + // Register prefs required by the component update service. + void RegisterComponentUpdateServicePrefs(PrefRegistrySimple* registry) { + // The component updates are enabled by default, if the preference is not set. +- registry->RegisterBooleanPref(prefs::kComponentUpdatesEnabled, true); ++ registry->RegisterBooleanPref(prefs::kComponentUpdatesEnabled, false); + } + + } // namespace component_updater +-- +2.25.1 diff --git a/build/patches/00Move-navigation-bar-to-bottom--add-fixup-.patch b/build/patches/00Move-navigation-bar-to-bottom--add-fixup-.patch new file mode 100644 index 00000000..4ecf1edc --- /dev/null +++ b/build/patches/00Move-navigation-bar-to-bottom--add-fixup-.patch @@ -0,0 +1,52 @@ +From: Your Name +Date: Mon, 7 Nov 2022 16:09:55 +0000 +Subject: Move navigation bar to bottom (add fixup) + +--- + .../browser/ui/system/StatusBarColorController.java | 9 +++++++++ + .../org/chromium/chrome/browser/ui/appmenu/AppMenu.java | 5 +++++ + 2 files changed, 14 insertions(+) + +diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ui/system/StatusBarColorController.java b/chrome/android/java/src/org/chromium/chrome/browser/ui/system/StatusBarColorController.java +--- a/chrome/android/java/src/org/chromium/chrome/browser/ui/system/StatusBarColorController.java ++++ b/chrome/android/java/src/org/chromium/chrome/browser/ui/system/StatusBarColorController.java +@@ -13,6 +13,9 @@ import android.view.Window; + import androidx.annotation.ColorInt; + import androidx.annotation.Nullable; + ++import org.chromium.chrome.browser.flags.ChromeFeatureList; ++import org.chromium.chrome.browser.flags.CachedFeatureFlags; ++ + import org.chromium.base.ApiCompatibilityUtils; + import org.chromium.base.CallbackController; + import org.chromium.base.supplier.ObservableSupplier; +@@ -347,6 +350,12 @@ public class StatusBarColorController + boolean needsDarkStatusBarIcons = !ColorUtils.shouldUseLightForegroundOnBackground(color); + ApiCompatibilityUtils.setStatusBarIconColor(root, needsDarkStatusBarIcons); + ApiCompatibilityUtils.setStatusBarColor(mWindow, color); ++ if (CachedFeatureFlags.isEnabled(ChromeFeatureList.MOVE_TOP_TOOLBAR_TO_BOTTOM) && ++ Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { ++ UiUtils.setNavigationBarIconColor(mWindow.getDecorView().getRootView(), ++ needsDarkStatusBarIcons); ++ mWindow.setNavigationBarColor(color); ++ } + } + + /** +diff --git a/chrome/browser/ui/android/appmenu/internal/java/src/org/chromium/chrome/browser/ui/appmenu/AppMenu.java b/chrome/browser/ui/android/appmenu/internal/java/src/org/chromium/chrome/browser/ui/appmenu/AppMenu.java +--- a/chrome/browser/ui/android/appmenu/internal/java/src/org/chromium/chrome/browser/ui/appmenu/AppMenu.java ++++ b/chrome/browser/ui/android/appmenu/internal/java/src/org/chromium/chrome/browser/ui/appmenu/AppMenu.java +@@ -310,6 +310,11 @@ class AppMenu implements OnItemClickListener, OnKeyListener, AppMenuClickHandler + if (popupHeight + popupPosition[1] > visibleDisplayFrame.bottom) { + mPopup.setHeight(visibleDisplayFrame.height()); + } ++ if (CachedFeatureFlags.isEnabled(ChromeFeatureList.MOVE_TOP_TOOLBAR_TO_BOTTOM)) { ++ // due to some unknown behaviour, the popup must be resized to ++ // allow selection without leaving touch ++ mPopup.setHeight(popupHeight-1); ++ } + + try { + mPopup.showAtLocation(anchorView.getRootView(), Gravity.NO_GRAVITY, popupPosition[0], +-- +2.25.1