Bug 1947480 - Fix telemetry code to work for Navigation heuristic - r=timhuang,anti-tracking-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D239008
This commit is contained in:
@@ -84,7 +84,6 @@ interface nsIURIClassifier : nsISupports
|
||||
* Asynchronously classify a URI with list of features. This does not make
|
||||
* network requests. This takes a list of names so it can safely be called in
|
||||
* the content process.
|
||||
* This is content process only, and will ASSERT otherwise.
|
||||
*/
|
||||
void asyncClassifyLocalWithFeatureNames(in nsIURI aURI,
|
||||
in Array<ACString> aFeatures,
|
||||
|
||||
@@ -1340,6 +1340,7 @@ void StorageAccessGrantTelemetryClassification::MaybeReportTracker(
|
||||
|
||||
rv = uriClassifier->AsyncClassifyLocalWithFeatureNames(
|
||||
aURI, featureNames, nsIUrlClassifierFeature::blocklist, classification);
|
||||
Unused << NS_WARN_IF(NS_FAILED(rv));
|
||||
}
|
||||
|
||||
// nsIUrlClassifierFeatureCallback
|
||||
|
||||
@@ -2566,12 +2566,26 @@ nsUrlClassifierDBService::AsyncClassifyLocalWithFeatureNames(
|
||||
nsIUrlClassifierFeature::listType aListType,
|
||||
nsIUrlClassifierFeatureCallback* aCallback) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(XRE_IsContentProcess());
|
||||
|
||||
if (gShuttingDownThread) {
|
||||
return NS_ERROR_ABORT;
|
||||
}
|
||||
|
||||
if (!XRE_IsContentProcess()) {
|
||||
nsTArray<RefPtr<nsIUrlClassifierFeature>> features;
|
||||
for (const nsCString& featureName : aFeatureNames) {
|
||||
nsCOMPtr<nsIUrlClassifierFeature> feature =
|
||||
mozilla::net::UrlClassifierFeatureFactory::GetFeatureByName(
|
||||
featureName);
|
||||
if (NS_WARN_IF(!feature)) {
|
||||
continue;
|
||||
}
|
||||
features.AppendElement(feature);
|
||||
}
|
||||
MOZ_ASSERT(!features.IsEmpty(), "At least one URL classifier feature must be present");
|
||||
return AsyncClassifyLocalWithFeatures(aURI, features, aListType, aCallback, true);
|
||||
}
|
||||
|
||||
mozilla::dom::ContentChild* content =
|
||||
mozilla::dom::ContentChild::GetSingleton();
|
||||
if (NS_WARN_IF(!content || content->IsShuttingDown())) {
|
||||
|
||||
Reference in New Issue
Block a user