-
Notifications
You must be signed in to change notification settings - Fork 869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes error thrown when speculation rules are disabled #13772
Conversation
// kSpeculationRulesPrefetchProxy and kPrerender2 are disabled in Brave per | ||
// https://github.com/brave/brave-core/commit/fe8b2f327f258c241345c67ba7224bd34d34a6fc | ||
// So we have nothing to do here. Overriding this function just to avoid | ||
// ReportBadMessage. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should fix brave/chromium_src/third_party/blink/common/origin_trials/origin_trials.cc
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@goodov cloud you elaborate? What fix can be applied there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure right now, but adding SpeculationRulesPrefetchProxy
into the list of disabled features in origin_trials.cc
won't fix the issue? (there're two lists)
It looks like the feature is partially disabled now. Because of that we see this incorrect request on the browser side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably add kSpeculationRulesPrefetchProxy
there either way, but it doesn't fix error. We still hit it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be more specific, this change doesn't help
--- a/chromium_src/third_party/blink/common/origin_trials/origin_trials.cc
+++ b/chromium_src/third_party/blink/common/origin_trials/origin_trials.cc
@@ -35,6 +35,7 @@ bool IsTrialDisabledInBrave(base::StringPiece trial_name) {
"Prerender2",
"PrivacySandboxAdsAPIs",
"SignedExchangeSubresourcePrefetch",
+ "SpeculationRulesPrefetch",
"SubresourceWebBundles",
"TrustTokens",
};
@@ -65,6 +66,7 @@ bool IsTrialDisabledInBrave(OriginTrialFeature feature) {
OriginTrialFeature::kPrerender2,
OriginTrialFeature::kPrivacySandboxAdsAPIs,
OriginTrialFeature::kSignedExchangeSubresourcePrefetch,
+ OriginTrialFeature::kSpeculationRulesPrefetchProxy,
OriginTrialFeature::kTrustTokens,
};
// clang-format on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. I'll try to figure out what's going on there with feature/trial disabling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@samartnik a better fix is to remove this line: chromium/chromium@3c9efd5#diff-a800f352ae257f734b958312eedfc8fd15d26d50574ecc4c4e639b9a1d825df3R2197
I'm okay with patching it until we figure out what is the better way to do this without patches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you want just directly patch it instead of chromium_src
changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I've got a patchless solution. Put this file into brave/chromium_src/content/child/runtime_features.cc
:
https://gist.github.com/goodov/a62434bb5e940b2f9f6b26e711bdc638
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@samartnik Actually there is even a better place which already does exactly this:
brave-core/renderer/brave_content_renderer_client.cc
Lines 30 to 46 in 77a4b69
void BraveContentRendererClient:: | |
SetRuntimeFeaturesDefaultsBeforeBlinkInitialization() { | |
ChromeContentRendererClient:: | |
SetRuntimeFeaturesDefaultsBeforeBlinkInitialization(); | |
blink::WebRuntimeFeatures::EnableWebNfc(false); | |
// These features don't have dedicated WebRuntimeFeatures wrappers. | |
blink::WebRuntimeFeatures::EnableFeatureFromString("DigitalGoods", false); | |
if (!base::FeatureList::IsEnabled(blink::features::kFileSystemAccessAPI)) { | |
blink::WebRuntimeFeatures::EnableFeatureFromString("FileSystemAccess", | |
false); | |
blink::WebRuntimeFeatures::EnableFeatureFromString( | |
"FileSystemAccessAPIExperimental", false); | |
} | |
blink::WebRuntimeFeatures::EnableFeatureFromString("Serial", false); | |
} |
Just add a single line with this exact feature right there and we should be fine. No need to add new source file.
5145259
to
0c63abc
Compare
0c63abc
to
a211abc
Compare
Fixes error thrown when speculation rules are disabled
Verified on
STR - brave/brave-browser#23433 (comment)
|
Fixes error thrown when speculation rules are disabled
We originally disabled it for brave/brave-browser#23433 via #13772, but the issue is no longer reproducible in cr121, so we can just drop the call to disable the flag. Chromium change: https://chromium.googlesource.com/chromium/src/+/d1cf902be6fc9ae8654fe5a6c466dfb51f782197 commit d1cf902be6fc9ae8654fe5a6c466dfb51f782197 Author: Jeremy Roman <[email protected]> Date: Thu Nov 9 16:38:02 2023 +0000 Remove RuntimeEnabledFeatures checks for SpeculationRules and SpeculationRulesPrefetchProxy. These have been shipped for almost a year. Bug: 1173646
We originally disabled it for brave/brave-browser#23433 via #13772, but the issue is no longer reproducible in cr121, so we can just drop the call to disable the flag. Chromium change: https://chromium.googlesource.com/chromium/src/+/d1cf902be6fc9ae8654fe5a6c466dfb51f782197 commit d1cf902be6fc9ae8654fe5a6c466dfb51f782197 Author: Jeremy Roman <[email protected]> Date: Thu Nov 9 16:38:02 2023 +0000 Remove RuntimeEnabledFeatures checks for SpeculationRules and SpeculationRulesPrefetchProxy. These have been shipped for almost a year. Bug: 1173646
We originally disabled it for brave/brave-browser#23433 via #13772, but the issue is no longer reproducible in cr121, so we can just drop the call to disable the flag. Chromium change: https://chromium.googlesource.com/chromium/src/+/d1cf902be6fc9ae8654fe5a6c466dfb51f782197 commit d1cf902be6fc9ae8654fe5a6c466dfb51f782197 Author: Jeremy Roman <[email protected]> Date: Thu Nov 9 16:38:02 2023 +0000 Remove RuntimeEnabledFeatures checks for SpeculationRules and SpeculationRulesPrefetchProxy. These have been shipped for almost a year. Bug: 1173646
We originally disabled it for brave/brave-browser#23433 via #13772, but the issue is no longer reproducible in cr121, so we can just drop the call to disable the flag. Chromium change: https://chromium.googlesource.com/chromium/src/+/d1cf902be6fc9ae8654fe5a6c466dfb51f782197 commit d1cf902be6fc9ae8654fe5a6c466dfb51f782197 Author: Jeremy Roman <[email protected]> Date: Thu Nov 9 16:38:02 2023 +0000 Remove RuntimeEnabledFeatures checks for SpeculationRules and SpeculationRulesPrefetchProxy. These have been shipped for almost a year. Bug: 1173646
We originally disabled it for brave/brave-browser#23433 via #13772, but the issue is no longer reproducible in cr121, so we can just drop the call to disable the flag. Chromium change: https://chromium.googlesource.com/chromium/src/+/d1cf902be6fc9ae8654fe5a6c466dfb51f782197 commit d1cf902be6fc9ae8654fe5a6c466dfb51f782197 Author: Jeremy Roman <[email protected]> Date: Thu Nov 9 16:38:02 2023 +0000 Remove RuntimeEnabledFeatures checks for SpeculationRules and SpeculationRulesPrefetchProxy. These have been shipped for almost a year. Bug: 1173646
We originally disabled it for brave/brave-browser#23433 via #13772, but the issue is no longer reproducible in cr121, so we can just drop the call to disable the flag. Chromium change: https://chromium.googlesource.com/chromium/src/+/d1cf902be6fc9ae8654fe5a6c466dfb51f782197 commit d1cf902be6fc9ae8654fe5a6c466dfb51f782197 Author: Jeremy Roman <[email protected]> Date: Thu Nov 9 16:38:02 2023 +0000 Remove RuntimeEnabledFeatures checks for SpeculationRules and SpeculationRulesPrefetchProxy. These have been shipped for almost a year. Bug: 1173646
We originally disabled it for brave/brave-browser#23433 via #13772, but the issue is no longer reproducible in cr121, so we can just drop the call to disable the flag. Chromium change: https://chromium.googlesource.com/chromium/src/+/d1cf902be6fc9ae8654fe5a6c466dfb51f782197 commit d1cf902be6fc9ae8654fe5a6c466dfb51f782197 Author: Jeremy Roman <[email protected]> Date: Thu Nov 9 16:38:02 2023 +0000 Remove RuntimeEnabledFeatures checks for SpeculationRules and SpeculationRulesPrefetchProxy. These have been shipped for almost a year. Bug: 1173646
We originally disabled it for brave/brave-browser#23433 via #13772, but the issue is no longer reproducible in cr121, so we can just drop the call to disable the flag. Chromium change: https://chromium.googlesource.com/chromium/src/+/d1cf902be6fc9ae8654fe5a6c466dfb51f782197 commit d1cf902be6fc9ae8654fe5a6c466dfb51f782197 Author: Jeremy Roman <[email protected]> Date: Thu Nov 9 16:38:02 2023 +0000 Remove RuntimeEnabledFeatures checks for SpeculationRules and SpeculationRulesPrefetchProxy. These have been shipped for almost a year. Bug: 1173646
Resolves brave/brave-browser#23433
The error we hit is:
[ERROR:render_process_host_impl.cc(5119)] Terminating render process for bad Mojo message: Received bad user message: Speculation rules must be enabled to bind to blink.mojom.SpeculationHost in the browser.
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
,npm run lint
,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan: