Merge pull request #13048 from brave/issues/21504
Remove renderer rule updater in favor of our upstreamed impl.
This commit is contained in:
@@ -19,7 +19,6 @@
|
||||
#include "brave/components/brave_shields/common/pref_names.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/common/renderer_configuration.mojom.h"
|
||||
#include "components/content_settings/core/common/content_settings_utils.h"
|
||||
#include "components/prefs/pref_registry_simple.h"
|
||||
#include "components/prefs/pref_service.h"
|
||||
#include "components/user_prefs/user_prefs.h"
|
||||
@@ -29,8 +28,6 @@
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "extensions/buildflags/buildflags.h"
|
||||
#include "ipc/ipc_channel_proxy.h"
|
||||
#include "ipc/ipc_message_macros.h"
|
||||
#include "mojo/public/cpp/bindings/associated_remote.h"
|
||||
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
|
||||
|
||||
|
||||
@@ -201,17 +201,9 @@ IN_PROC_BROWSER_TEST_F(BraveShieldsAPIBrowserTest, AllowScriptsOnceDataURL) {
|
||||
<< "Scripts from a.test and data URL should be temporarily allowed.";
|
||||
}
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(BraveShieldsAPIBrowserTest, PRE_AllowScriptsOnceIframe) {
|
||||
// Block scripts in a PRE_ test to workaround an upstream bug [1] when a spare
|
||||
// renderer process doesn't receive ContentSettings updates after being
|
||||
// created.
|
||||
// Workaround should be removed when upstream will be fixed.
|
||||
//
|
||||
// 1. https://bugs.chromium.org/p/chromium/issues/detail?id=1294211
|
||||
BlockScripts();
|
||||
}
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(BraveShieldsAPIBrowserTest, AllowScriptsOnceIframe) {
|
||||
BlockScripts();
|
||||
|
||||
EXPECT_TRUE(NavigateToURLUntilLoadStop("a.com", "/remote_iframe.html"));
|
||||
EXPECT_EQ(GetActiveRenderFrameHosts().size(), 2u)
|
||||
<< "All script loadings should be blocked.";
|
||||
|
||||
@@ -18,14 +18,19 @@ namespace content_settings {
|
||||
void GetRendererContentSettingRules(const HostContentSettingsMap* map,
|
||||
RendererContentSettingRules* rules) {
|
||||
GetRendererContentSettingRules_ChromiumImpl(map, rules);
|
||||
map->GetSettingsForOneType(ContentSettingsType::AUTOPLAY,
|
||||
&(rules->autoplay_rules));
|
||||
map->GetSettingsForOneType(ContentSettingsType::BRAVE_FINGERPRINTING_V2,
|
||||
&(rules->fingerprinting_rules));
|
||||
map->GetSettingsForOneType(ContentSettingsType::BRAVE_SHIELDS,
|
||||
&(rules->brave_shields_rules));
|
||||
map->GetSettingsForOneType(ContentSettingsType::BRAVE_COSMETIC_FILTERING,
|
||||
&(rules->cosmetic_filtering_rules));
|
||||
std::pair<ContentSettingsType, ContentSettingsForOneType*> settings[] = {
|
||||
{ContentSettingsType::AUTOPLAY, &rules->autoplay_rules},
|
||||
{ContentSettingsType::BRAVE_FINGERPRINTING_V2,
|
||||
&rules->fingerprinting_rules},
|
||||
{ContentSettingsType::BRAVE_SHIELDS, &rules->brave_shields_rules},
|
||||
{ContentSettingsType::BRAVE_COSMETIC_FILTERING,
|
||||
&rules->cosmetic_filtering_rules},
|
||||
};
|
||||
for (const auto& setting : settings) {
|
||||
DCHECK(
|
||||
RendererContentSettingRules::IsRendererContentSetting(setting.first));
|
||||
map->GetSettingsForOneType(setting.first, setting.second);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace content_settings
|
||||
|
||||
Reference in New Issue
Block a user