Skip to content

Commit 66f1a30

Browse files
committed
Bug 1821283 - OHTTP experiment setup r=keeler,necko-reviewers,jesup
Differential Revision: https://phabricator.services.mozilla.com/D172122
1 parent 983c039 commit 66f1a30

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed

browser/components/doh/DoHController.sys.mjs

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ ChromeUtils.defineESModuleGetters(lazy, {
2121
setTimeout: "resource://gre/modules/Timer.sys.mjs",
2222
});
2323

24+
XPCOMUtils.defineLazyModuleGetters(lazy, {
25+
NimbusFeatures: "resource://nimbus/ExperimentAPI.jsm",
26+
ExperimentAPI: "resource://nimbus/ExperimentAPI.jsm",
27+
});
28+
2429
// When this is set we suppress automatic TRR selection beyond dry-run as well
2530
// as sending observer notifications during heuristics throttling.
2631
XPCOMUtils.defineLazyPreferenceGetter(
@@ -235,10 +240,19 @@ export const DoHController = {
235240
// If we enter this branch it means that no automatic selection was possible.
236241
// In this case, we try to set a fallback (as defined by DoHConfigController).
237242
if (!lazy.Preferences.isSet(ROLLOUT_URI_PREF)) {
238-
lazy.Preferences.set(
239-
ROLLOUT_URI_PREF,
240-
lazy.DoHConfigController.currentConfig.fallbackProviderURI
241-
);
243+
let uri = lazy.DoHConfigController.currentConfig.fallbackProviderURI;
244+
245+
// If part of the treatment branch use the URL from the experiment.
246+
try {
247+
let ohttpURI = lazy.NimbusFeatures.dooh.getVariable("ohttpUri");
248+
if (ohttpURI) {
249+
uri = ohttpURI;
250+
}
251+
} catch (e) {
252+
console.error(`Error getting dooh.ohttpURI: ${e.message}`);
253+
}
254+
255+
lazy.Preferences.set(ROLLOUT_URI_PREF, uri);
242256
}
243257
this.runHeuristicsThrottled("startup");
244258
Services.obs.addObserver(this, kLinkStatusChangedTopic);
@@ -359,7 +373,12 @@ export const DoHController = {
359373
networkID: getHashedNetworkID(),
360374
};
361375

362-
if (results.steeredProvider) {
376+
const oHTTPexperiment = lazy.ExperimentAPI.getExperimentMetaData({
377+
featureId: "dooh",
378+
});
379+
380+
// When the OHTTP experiment is active we don't want to enable steering.
381+
if (results.steeredProvider && !oHTTPexperiment) {
363382
Services.dns.setDetectedTrrURI(results.steeredProvider.uri);
364383
resultsForTelemetry.steeredProvider = results.steeredProvider.id;
365384
}

toolkit/components/nimbus/FeatureManifest.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,12 @@ dohPrefs:
984984
description: Same as trrUri, but set by the DoHController module.
985985
type: string
986986
setPref: "doh-rollout.uri"
987+
988+
dooh:
989+
description: "DNS over Oblivious HTTP"
990+
owner: vgosu@mozilla.com
991+
hasExposure: false
992+
variables:
987993
ohttpEnabled:
988994
description: Whether to use Oblivious HTTP for the resolution
989995
type: boolean
@@ -996,6 +1002,10 @@ dohPrefs:
9961002
description: The URL used to fetch the configuration of the Oblivious HTTP gateway
9971003
type: string
9981004
setPref: "network.trr.ohttp.config_uri"
1005+
ohttpUri:
1006+
description: The URL of the Oblivious DNS over HTTPS target resource
1007+
type: string
1008+
setPref: "network.trr.ohttp.uri"
9991009

10001010
pingsender:
10011011
description: "In-product usage of the pingsender telemetry reporter."

0 commit comments

Comments
 (0)