Remove usage of v8::FunctionTemplate::New data param in auction_worklet/
Change-Id: Ibabb1c130c6559df98e90c378f0238f5ca8a626f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6219387 Commit-Queue: Nate Chapin <japhet@chromium.org> Reviewed-by: Caleb Raitto <caraitto@chromium.org> Cr-Commit-Position: refs/heads/main@{#1417565}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
6f6e2054f7
commit
628ed684b2
content/services/auction_worklet
@ -89,30 +89,35 @@ void ForDebuggingOnlyBindings::AttachToContext(v8::Local<v8::Context> context) {
|
||||
v8::Local<v8::External> v8_this = v8::External::New(isolate, this);
|
||||
v8::Local<v8::Object> debugging = v8::Object::New(isolate);
|
||||
|
||||
v8::Local<v8::FunctionTemplate> loss_template = v8::FunctionTemplate::New(
|
||||
isolate, &ForDebuggingOnlyBindings::ReportAdAuctionLoss, v8_this);
|
||||
v8::Local<v8::FunctionTemplate> win_template = v8::FunctionTemplate::New(
|
||||
isolate, &ForDebuggingOnlyBindings::ReportAdAuctionWin, v8_this);
|
||||
// If runtime flag BiddingAndScoringDebugReportingAPI is not enabled,
|
||||
// forDebuggingOnly.reportAdAuctionLoss() and
|
||||
// forDebuggingOnly.reportAdAuctionWin() APIs will be disabled (do nothing).
|
||||
// They are still valid APIs doing nothing instead of causing Javascript
|
||||
// errors.
|
||||
if (!base::FeatureList::IsEnabled(
|
||||
blink::features::kBiddingAndScoringDebugReportingAPI)) {
|
||||
loss_template = v8::FunctionTemplate::New(isolate);
|
||||
win_template = v8::FunctionTemplate::New(isolate);
|
||||
}
|
||||
loss_template->RemovePrototype();
|
||||
bool enabled = base::FeatureList::IsEnabled(
|
||||
blink::features::kBiddingAndScoringDebugReportingAPI);
|
||||
|
||||
v8::Local<v8::Function> loss_function =
|
||||
v8::Function::New(
|
||||
context,
|
||||
enabled ? &ForDebuggingOnlyBindings::ReportAdAuctionLoss : nullptr,
|
||||
v8_this)
|
||||
.ToLocalChecked();
|
||||
v8::Local<v8::Function> win_function =
|
||||
v8::Function::New(
|
||||
context,
|
||||
enabled ? &ForDebuggingOnlyBindings::ReportAdAuctionWin : nullptr,
|
||||
v8_this)
|
||||
.ToLocalChecked();
|
||||
|
||||
debugging
|
||||
->Set(context, v8_helper_->CreateStringFromLiteral("reportAdAuctionLoss"),
|
||||
loss_template->GetFunction(context).ToLocalChecked())
|
||||
loss_function)
|
||||
.Check();
|
||||
|
||||
win_template->RemovePrototype();
|
||||
debugging
|
||||
->Set(context, v8_helper_->CreateStringFromLiteral("reportAdAuctionWin"),
|
||||
win_template->GetFunction(context).ToLocalChecked())
|
||||
win_function)
|
||||
.Check();
|
||||
|
||||
context->Global()
|
||||
|
@ -115,14 +115,15 @@ void RealTimeReportingBindings::AttachToContext(
|
||||
v8::Local<v8::External> v8_this = v8::External::New(isolate, this);
|
||||
v8::Local<v8::Object> real_time_reporting = v8::Object::New(isolate);
|
||||
|
||||
v8::Local<v8::FunctionTemplate> real_time_histogram_template =
|
||||
v8::FunctionTemplate::New(
|
||||
isolate, &RealTimeReportingBindings::ContributeToHistogram, v8_this);
|
||||
v8::Local<v8::Function> real_time_histogram =
|
||||
v8::Function::New(
|
||||
context, &RealTimeReportingBindings::ContributeToHistogram, v8_this)
|
||||
.ToLocalChecked();
|
||||
|
||||
real_time_reporting
|
||||
->Set(context,
|
||||
v8_helper_->CreateStringFromLiteral("contributeToHistogram"),
|
||||
real_time_histogram_template->GetFunction(context).ToLocalChecked())
|
||||
real_time_histogram)
|
||||
.Check();
|
||||
|
||||
context->Global()
|
||||
|
Reference in New Issue
Block a user