Commit 056ec4bb authored by Alex Turner's avatar Alex Turner Committed by Chromium LUCI CQ

Remove top-of-stack-only experimental AdTagging code

The experiment is being abandoned, so this cl removes the code for it.

Bug: 1161316
Change-Id: I4d5091982874f1c36afbf21c6e81eee867e08ed9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2597853Reviewed-by: default avatarJosh Karlin <jkarlin@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#840281}
parent ecdca84d
...@@ -51,11 +51,6 @@ namespace features { ...@@ -51,11 +51,6 @@ namespace features {
// the currently running stack is ad related. // the currently running stack is ad related.
const base::Feature kAsyncStackAdTagging{"AsyncStackAdTagging", const base::Feature kAsyncStackAdTagging{"AsyncStackAdTagging",
base::FEATURE_ENABLED_BY_DEFAULT}; base::FEATURE_ENABLED_BY_DEFAULT};
// Controls whether the AdTracker analyzes the bottom and top of the stack or
// just the top of the stack when detecting ads.
const base::Feature kTopOfStackAdTagging{"TopOfStackAdTagging",
base::FEATURE_DISABLED_BY_DEFAULT};
} // namespace features } // namespace features
// static // static
...@@ -82,9 +77,7 @@ bool AdTracker::IsAdScriptExecutingInDocument(Document* document, ...@@ -82,9 +77,7 @@ bool AdTracker::IsAdScriptExecutingInDocument(Document* document,
AdTracker::AdTracker(LocalFrame* local_root) AdTracker::AdTracker(LocalFrame* local_root)
: local_root_(local_root), : local_root_(local_root),
async_stack_enabled_( async_stack_enabled_(
base::FeatureList::IsEnabled(features::kAsyncStackAdTagging)), base::FeatureList::IsEnabled(features::kAsyncStackAdTagging)) {
top_of_stack_only_(
base::FeatureList::IsEnabled(features::kTopOfStackAdTagging)) {
local_root_->GetProbeSink()->AddAdTracker(this); local_root_->GetProbeSink()->AddAdTracker(this);
} }
...@@ -149,9 +142,6 @@ void AdTracker::WillExecuteScript(ExecutionContext* execution_context, ...@@ -149,9 +142,6 @@ void AdTracker::WillExecuteScript(ExecutionContext* execution_context,
} }
} }
if (top_of_stack_only_)
return;
if (!should_track_with_id) if (!should_track_with_id)
is_ad = IsKnownAdScript(execution_context, script_url); is_ad = IsKnownAdScript(execution_context, script_url);
...@@ -161,9 +151,6 @@ void AdTracker::WillExecuteScript(ExecutionContext* execution_context, ...@@ -161,9 +151,6 @@ void AdTracker::WillExecuteScript(ExecutionContext* execution_context,
} }
void AdTracker::DidExecuteScript() { void AdTracker::DidExecuteScript() {
if (top_of_stack_only_)
return;
if (stack_frame_is_ad_.back()) { if (stack_frame_is_ad_.back()) {
DCHECK_LT(0u, num_ads_in_stack_); DCHECK_LT(0u, num_ads_in_stack_);
num_ads_in_stack_ -= 1; num_ads_in_stack_ -= 1;
......
...@@ -30,7 +30,6 @@ class ExecuteScript; ...@@ -30,7 +30,6 @@ class ExecuteScript;
namespace features { namespace features {
CORE_EXPORT extern const base::Feature kAsyncStackAdTagging; CORE_EXPORT extern const base::Feature kAsyncStackAdTagging;
CORE_EXPORT extern const base::Feature kTopOfStackAdTagging;
} }
// Tracker for tagging resources as ads based on the call stack scripts. // Tracker for tagging resources as ads based on the call stack scripts.
...@@ -134,10 +133,6 @@ class CORE_EXPORT AdTracker : public GarbageCollected<AdTracker> { ...@@ -134,10 +133,6 @@ class CORE_EXPORT AdTracker : public GarbageCollected<AdTracker> {
// callstack to run (e.g., registered callbacks). // callstack to run (e.g., registered callbacks).
const bool async_stack_enabled_; const bool async_stack_enabled_;
// True if the TopOfStack experiment is running, which forces the AdTracker to
// ignore the bottom of stack frames when looking for ad script.
const bool top_of_stack_only_;
DISALLOW_COPY_AND_ASSIGN(AdTracker); DISALLOW_COPY_AND_ASSIGN(AdTracker);
}; };
......
...@@ -262,36 +262,6 @@ TEST_F(AdTrackerTest, TopScriptTaggedAsAdResource) { ...@@ -262,36 +262,6 @@ TEST_F(AdTrackerTest, TopScriptTaggedAsAdResource) {
AdTracker::StackType::kBottomOnly)); AdTracker::StackType::kBottomOnly));
} }
TEST_F(AdTrackerTest, TopOfStackOnly_NoAdsOnTop) {
base::test::ScopedFeatureList feature_list;
feature_list.InitAndEnableFeature(features::kTopOfStackAdTagging);
CreateAdTracker();
String ad_script_url("https://example.com/bar.js");
AppendToKnownAdScripts(ad_script_url);
WillExecuteScript(ad_script_url);
WillExecuteScript("https://example.com/foo.js");
ad_tracker_->SetScriptAtTopOfStack("https://www.example.com/baz.js");
EXPECT_FALSE(AnyExecutingScriptsTaggedAsAdResource());
}
TEST_F(AdTrackerTest, TopOfStackOnly_AdsOnTop) {
base::test::ScopedFeatureList feature_list;
feature_list.InitAndEnableFeature(features::kTopOfStackAdTagging);
CreateAdTracker();
String ad_script_url("https://example.com/bar.js");
AppendToKnownAdScripts(ad_script_url);
WillExecuteScript(ad_script_url);
WillExecuteScript("https://example.com/foo.js");
ad_tracker_->SetScriptAtTopOfStack(ad_script_url);
EXPECT_TRUE(AnyExecutingScriptsTaggedAsAdResource());
}
// Tests that if neither script in the stack is an ad, // Tests that if neither script in the stack is an ad,
// AnyExecutingScriptsTaggedAsAdResource should return false. // AnyExecutingScriptsTaggedAsAdResource should return false.
TEST_F(AdTrackerTest, AnyExecutingScriptsTaggedAsAdResource_False) { TEST_F(AdTrackerTest, AnyExecutingScriptsTaggedAsAdResource_False) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment