зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1566998 - Improve awaiting new TRRDNSListener by returning an object r=necko-reviewers,kershaw
It's nicer to destructure the response using `let {inRecord, inStatus} = await new TRRDNSListener(...)` instead of `let [,inRecord,inStatus] = await new TRRDNSListener(...)` Differential Revision: https://phabricator.services.mozilla.com/D130042
This commit is contained in:
Родитель
272f24ea0c
Коммит
37f236afbe
|
@ -153,7 +153,7 @@ class TRRDNSListener {
|
|||
Assert.ok(!this.options.expectEarlyFail);
|
||||
} catch (e) {
|
||||
Assert.ok(this.options.expectEarlyFail);
|
||||
this.resolve([e]);
|
||||
this.resolve({ error: e });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -166,14 +166,14 @@ class TRRDNSListener {
|
|||
// If we don't expect success here, just resolve and the caller will
|
||||
// decide what to do with the results.
|
||||
if (!this.expectedSuccess) {
|
||||
this.resolve([inRequest, inRecord, inStatus]);
|
||||
this.resolve({ inRequest, inRecord, inStatus });
|
||||
return;
|
||||
}
|
||||
|
||||
Assert.equal(inStatus, Cr.NS_OK, "Checking status");
|
||||
|
||||
if (this.type != Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT) {
|
||||
this.resolve([inRequest, inRecord, inStatus]);
|
||||
this.resolve({ inRequest, inRecord, inStatus });
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,7 @@ class TRRDNSListener {
|
|||
}
|
||||
}
|
||||
|
||||
this.resolve([inRequest, inRecord, inStatus]);
|
||||
this.resolve({ inRequest, inRecord, inStatus });
|
||||
}
|
||||
|
||||
QueryInterface(aIID) {
|
||||
|
|
|
@ -39,7 +39,7 @@ add_task(async function testTXTResolve() {
|
|||
"https://foo.example.com:" + h2Port + "/doh"
|
||||
);
|
||||
|
||||
let [, inRecord] = await new TRRDNSListener("_esni.example.com", {
|
||||
let { inRecord } = await new TRRDNSListener("_esni.example.com", {
|
||||
type: dns.RESOLVE_TYPE_TXT,
|
||||
});
|
||||
|
||||
|
@ -55,7 +55,7 @@ add_task(async function testTXTRecordPushPart1() {
|
|||
"network.trr.uri",
|
||||
"https://foo.example.com:" + h2Port + "/txt-dns-push"
|
||||
);
|
||||
let [, inRecord] = await new TRRDNSListener("_esni_push.example.com", {
|
||||
let { inRecord } = await new TRRDNSListener("_esni_push.example.com", {
|
||||
type: dns.RESOLVE_TYPE_DEFAULT,
|
||||
expectedAnswer: "127.0.0.1",
|
||||
});
|
||||
|
@ -73,7 +73,7 @@ add_task(async function testTXTRecordPushPart2() {
|
|||
"network.trr.uri",
|
||||
"https://foo.example.com:" + h2Port + "/404"
|
||||
);
|
||||
let [, inRecord] = await new TRRDNSListener("_esni_push.example.com", {
|
||||
let { inRecord } = await new TRRDNSListener("_esni_push.example.com", {
|
||||
type: dns.RESOLVE_TYPE_TXT,
|
||||
});
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ add_task(async function testEchConfigEnabled() {
|
|||
],
|
||||
});
|
||||
|
||||
let [, inRecord] = await new TRRDNSListener("test.bar.com", {
|
||||
let { inRecord } = await new TRRDNSListener("test.bar.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
||||
|
@ -125,9 +125,9 @@ add_task(async function testEchConfigEnabled() {
|
|||
Services.prefs.setBoolPref("network.dns.echconfig.enabled", true);
|
||||
dns.clearCache(true);
|
||||
|
||||
[, inRecord] = await new TRRDNSListener("test.bar.com", {
|
||||
({ inRecord } = await new TRRDNSListener("test.bar.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
}));
|
||||
|
||||
checkResult(inRecord, false, false, {
|
||||
expectedPriority: 2,
|
||||
|
@ -203,7 +203,7 @@ add_task(async function testTwoRecordsHaveEchConfig() {
|
|||
],
|
||||
});
|
||||
|
||||
let [, inRecord] = await new TRRDNSListener("test.foo.com", {
|
||||
let { inRecord } = await new TRRDNSListener("test.foo.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
||||
|
@ -226,9 +226,9 @@ add_task(async function testTwoRecordsHaveEchConfig() {
|
|||
|
||||
Services.prefs.setBoolPref("network.dns.http3_echconfig.enabled", true);
|
||||
dns.clearCache(true);
|
||||
[, inRecord] = await new TRRDNSListener("test.foo.com", {
|
||||
({ inRecord } = await new TRRDNSListener("test.foo.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
}));
|
||||
|
||||
checkResult(inRecord, false, false, {
|
||||
expectedPriority: 1,
|
||||
|
@ -302,7 +302,7 @@ add_task(async function testTwoRecordsHaveEchConfig1() {
|
|||
],
|
||||
});
|
||||
|
||||
let [, inRecord] = await new TRRDNSListener("test.foo.com", {
|
||||
let { inRecord } = await new TRRDNSListener("test.foo.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
||||
|
@ -329,9 +329,9 @@ add_task(async function testTwoRecordsHaveEchConfig1() {
|
|||
|
||||
Services.prefs.setBoolPref("network.dns.http3_echconfig.enabled", true);
|
||||
dns.clearCache(true);
|
||||
[, inRecord] = await new TRRDNSListener("test.foo.com", {
|
||||
({ inRecord } = await new TRRDNSListener("test.foo.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
}));
|
||||
|
||||
checkResult(inRecord, false, false, {
|
||||
expectedPriority: 1,
|
||||
|
@ -405,7 +405,7 @@ add_task(async function testOneRecordsHasEchConfig() {
|
|||
],
|
||||
});
|
||||
|
||||
let [, inRecord] = await new TRRDNSListener("test.foo.com", {
|
||||
let { inRecord } = await new TRRDNSListener("test.foo.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
||||
|
@ -428,9 +428,9 @@ add_task(async function testOneRecordsHasEchConfig() {
|
|||
|
||||
Services.prefs.setBoolPref("network.dns.http3_echconfig.enabled", true);
|
||||
dns.clearCache(true);
|
||||
[, inRecord] = await new TRRDNSListener("test.foo.com", {
|
||||
({ inRecord } = await new TRRDNSListener("test.foo.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
}));
|
||||
|
||||
checkResult(inRecord, false, false, {
|
||||
expectedPriority: 1,
|
||||
|
@ -503,7 +503,7 @@ add_task(async function testHttp3AndHttp2Pref() {
|
|||
],
|
||||
});
|
||||
|
||||
let [, inRecord] = await new TRRDNSListener("test.foo.com", {
|
||||
let { inRecord } = await new TRRDNSListener("test.foo.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ add_task(async function testStoreIPHint() {
|
|||
],
|
||||
});
|
||||
|
||||
let [, inRecord] = await new TRRDNSListener("test.IPHint.com", {
|
||||
let { inRecord } = await new TRRDNSListener("test.IPHint.com", {
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
||||
|
@ -124,7 +124,7 @@ add_task(async function testStoreIPHint() {
|
|||
);
|
||||
|
||||
async function verifyAnswer(flags, answer) {
|
||||
let [, inRecord] = await new TRRDNSListener("test.IPHint.com", {
|
||||
let { inRecord } = await new TRRDNSListener("test.IPHint.com", {
|
||||
flags,
|
||||
expectedSuccess: false,
|
||||
});
|
||||
|
@ -186,7 +186,7 @@ add_task(async function testConnectionWithIPHint() {
|
|||
);
|
||||
|
||||
// Resolving test.iphint.com should be failed.
|
||||
let [, , inStatus] = await new TRRDNSListener("test.iphint.com", {
|
||||
let { inStatus } = await new TRRDNSListener("test.iphint.com", {
|
||||
expectedSuccess: false,
|
||||
});
|
||||
Assert.equal(
|
||||
|
@ -265,7 +265,7 @@ add_task(async function testIPHintWithFreshDNS() {
|
|||
],
|
||||
});
|
||||
|
||||
let [, inRecord] = await new TRRDNSListener("test.iphint.org", {
|
||||
let { inRecord } = await new TRRDNSListener("test.iphint.org", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ add_task(async function testPriorityAndECHConfig() {
|
|||
],
|
||||
});
|
||||
|
||||
let [, inRecord] = await new TRRDNSListener("test.priority.com", {
|
||||
let { inRecord } = await new TRRDNSListener("test.priority.com", {
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
||||
|
@ -100,9 +100,9 @@ add_task(async function testPriorityAndECHConfig() {
|
|||
|
||||
Services.prefs.setBoolPref("network.dns.echconfig.enabled", true);
|
||||
dns.clearCache(true);
|
||||
[, inRecord] = await new TRRDNSListener("test.priority.com", {
|
||||
({ inRecord } = await new TRRDNSListener("test.priority.com", {
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
}));
|
||||
|
||||
answer = inRecord.QueryInterface(Ci.nsIDNSHTTPSSVCRecord).records;
|
||||
Assert.equal(answer.length, 4);
|
||||
|
|
|
@ -61,7 +61,7 @@ add_task(async function testODoHConfig() {
|
|||
"https://foo.example.com:" + h2Port + "/odohconfig"
|
||||
);
|
||||
|
||||
let [, inRecord] = await new TRRDNSListener("odoh_host.example.com", {
|
||||
let { inRecord } = await new TRRDNSListener("odoh_host.example.com", {
|
||||
type: Ci.nsIDNSService.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
let answer = inRecord.QueryInterface(Ci.nsIDNSHTTPSSVCRecord).records;
|
||||
|
|
|
@ -26,7 +26,7 @@ async function waitForConfirmation(expectedResponseIP, confirmationShouldFail) {
|
|||
// because of the increased delay between the emulator and host.
|
||||
await new Promise(resolve => do_timeout(100 * (100 / count), resolve));
|
||||
}
|
||||
let [, inRecord] = await new TRRDNSListener(
|
||||
let { inRecord } = await new TRRDNSListener(
|
||||
`ip${count}.example.org`,
|
||||
undefined,
|
||||
false
|
||||
|
@ -341,7 +341,7 @@ add_task(async function test_async_resolve_with_trr_server() {
|
|||
dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=2.2.2.2");
|
||||
|
||||
let [, , inStatus] = await new TRRDNSListener(
|
||||
let { inStatus } = await new TRRDNSListener(
|
||||
"bar_with_trr6.example.com",
|
||||
undefined,
|
||||
false,
|
||||
|
@ -406,13 +406,13 @@ add_task(async function test_async_resolve_with_trr_server() {
|
|||
dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=2.2.2.2");
|
||||
|
||||
[, , inStatus] = await new TRRDNSListener(
|
||||
({ inStatus } = await new TRRDNSListener(
|
||||
"only_once.example.com",
|
||||
undefined,
|
||||
false,
|
||||
undefined,
|
||||
`https://target.example.com:666/404`
|
||||
);
|
||||
));
|
||||
Assert.ok(
|
||||
!Components.isSuccessCode(inStatus),
|
||||
`${inStatus} should be an error code`
|
||||
|
|
|
@ -239,7 +239,7 @@ add_task(async function test_parse_additional_section() {
|
|||
],
|
||||
});
|
||||
|
||||
let [, inRecord] = await new TRRDNSListener("multiple.foo", {
|
||||
let { inRecord } = await new TRRDNSListener("multiple.foo", {
|
||||
expectedAnswer: "9.9.9.9",
|
||||
});
|
||||
let IPs = [];
|
||||
|
@ -251,9 +251,9 @@ add_task(async function test_parse_additional_section() {
|
|||
equal(IPs.length, 1);
|
||||
equal(IPs[0], "9.9.9.9");
|
||||
IPs = [];
|
||||
[, inRecord] = await new TRRDNSListener("yuiop.foo", {
|
||||
({ inRecord } = await new TRRDNSListener("yuiop.foo", {
|
||||
expectedSuccess: false,
|
||||
});
|
||||
}));
|
||||
inRecord.QueryInterface(Ci.nsIDNSAddrRecord);
|
||||
inRecord.rewind();
|
||||
while (inRecord.hasMore()) {
|
||||
|
|
|
@ -57,11 +57,11 @@ add_task(async function unspec_first() {
|
|||
flags: Ci.nsIDNSService.RESOLVE_DISABLE_IPV6,
|
||||
expectedAnswer: "1.2.3.4",
|
||||
});
|
||||
let [, , status] = await new TRRDNSListener("example.org", {
|
||||
let { inStatus } = await new TRRDNSListener("example.org", {
|
||||
flags: Ci.nsIDNSService.RESOLVE_DISABLE_IPV4,
|
||||
expectedSuccess: false,
|
||||
});
|
||||
equal(status, Cr.NS_ERROR_UNKNOWN_HOST);
|
||||
equal(inStatus, Cr.NS_ERROR_UNKNOWN_HOST);
|
||||
});
|
||||
|
||||
add_task(async function A_then_AAAA_fails() {
|
||||
|
@ -87,11 +87,11 @@ add_task(async function A_then_AAAA_fails() {
|
|||
flags: Ci.nsIDNSService.RESOLVE_DISABLE_IPV6,
|
||||
expectedAnswer: "1.2.3.4",
|
||||
});
|
||||
let [, , status] = await new TRRDNSListener("example.org", {
|
||||
let { inStatus } = await new TRRDNSListener("example.org", {
|
||||
flags: Ci.nsIDNSService.RESOLVE_DISABLE_IPV4,
|
||||
expectedSuccess: false,
|
||||
});
|
||||
equal(status, Cr.NS_ERROR_UNKNOWN_HOST);
|
||||
equal(inStatus, Cr.NS_ERROR_UNKNOWN_HOST);
|
||||
});
|
||||
|
||||
add_task(async function just_AAAA_fails() {
|
||||
|
@ -113,9 +113,9 @@ add_task(async function just_AAAA_fails() {
|
|||
],
|
||||
});
|
||||
// We only do an IPv6 req - we expect IPv6 not to fallback to Do53 because we have an IPv4 record
|
||||
let [, , status] = await new TRRDNSListener("example.org", {
|
||||
let { inStatus } = await new TRRDNSListener("example.org", {
|
||||
flags: Ci.nsIDNSService.RESOLVE_DISABLE_IPV4,
|
||||
expectedSuccess: false,
|
||||
});
|
||||
equal(status, Cr.NS_ERROR_UNKNOWN_HOST);
|
||||
equal(inStatus, Cr.NS_ERROR_UNKNOWN_HOST);
|
||||
});
|
||||
|
|
|
@ -63,7 +63,7 @@ add_task(async function cancel_immediately() {
|
|||
let r1 = new TRRDNSListener("example.org", { expectedSuccess: false });
|
||||
let r2 = new TRRDNSListener("example.org", { expectedAnswer: "2.3.4.5" });
|
||||
r1.cancel();
|
||||
let [, , inStatus] = await r1;
|
||||
let { inStatus } = await r1;
|
||||
equal(inStatus, Cr.NS_ERROR_ABORT);
|
||||
await r2;
|
||||
equal(await trrServer.requestCount("example.org", "A"), 1);
|
||||
|
@ -74,9 +74,9 @@ add_task(async function cancel_immediately() {
|
|||
r2 = new TRRDNSListener("example.org", { expectedSuccess: false });
|
||||
r1.cancel();
|
||||
r2.cancel();
|
||||
[, , inStatus] = await r1;
|
||||
({ inStatus } = await r1);
|
||||
equal(inStatus, Cr.NS_ERROR_ABORT);
|
||||
[, , inStatus] = await r2;
|
||||
({ inStatus } = await r2);
|
||||
equal(inStatus, Cr.NS_ERROR_ABORT);
|
||||
await new Promise(resolve => do_timeout(50, resolve));
|
||||
equal(await trrServer.requestCount("example.org", "A"), 2);
|
||||
|
@ -100,7 +100,7 @@ add_task(async function cancel_delayed() {
|
|||
let r2 = new TRRDNSListener("example.com", { expectedAnswer: "1.1.1.1" });
|
||||
await new Promise(resolve => do_timeout(50, resolve));
|
||||
r1.cancel();
|
||||
let [, , inStatus] = await r1;
|
||||
let { inStatus } = await r1;
|
||||
equal(inStatus, Cr.NS_ERROR_ABORT);
|
||||
await r2;
|
||||
});
|
||||
|
|
|
@ -82,7 +82,7 @@ add_task(async function test_follow_cnames_same_response() {
|
|||
},
|
||||
],
|
||||
});
|
||||
let [, inRecord] = await new TRRDNSListener("something.foo", {
|
||||
let { inRecord } = await new TRRDNSListener("something.foo", {
|
||||
expectedAnswer: "1.2.3.4",
|
||||
flags: Ci.nsIDNSService.RESOLVE_CANONICAL_NAME,
|
||||
});
|
||||
|
|
|
@ -54,7 +54,7 @@ add_task(async function intermittent_dns_mode3() {
|
|||
},
|
||||
],
|
||||
});
|
||||
let [, , inStatus] = await new TRRDNSListener("example.com", {
|
||||
let { inStatus } = await new TRRDNSListener("example.com", {
|
||||
expectedSuccess: false,
|
||||
});
|
||||
equal(inStatus, Cr.NS_ERROR_UNKNOWN_HOST);
|
||||
|
|
|
@ -87,7 +87,7 @@ add_task(async function test_extended_error_bogus() {
|
|||
});
|
||||
|
||||
// Check that we don't fall back to DNS
|
||||
let [, , inStatus] = await new TRRDNSListener("a.foo", {
|
||||
let { inStatus } = await new TRRDNSListener("a.foo", {
|
||||
expectedSuccess: false,
|
||||
});
|
||||
Assert.ok(
|
||||
|
@ -116,7 +116,7 @@ add_task(async function test_extended_error_filtered() {
|
|||
});
|
||||
|
||||
// Check that we don't fall back to DNS
|
||||
let [, , inStatus] = await new TRRDNSListener("b.foo", {
|
||||
let { inStatus } = await new TRRDNSListener("b.foo", {
|
||||
expectedSuccess: false,
|
||||
});
|
||||
Assert.ok(
|
||||
|
@ -315,7 +315,7 @@ add_task(async function test_only_ipv4_extended_error() {
|
|||
},
|
||||
],
|
||||
});
|
||||
let [, , inStatus] = await new TRRDNSListener("only.com", {
|
||||
let { inStatus } = await new TRRDNSListener("only.com", {
|
||||
expectedSuccess: false,
|
||||
});
|
||||
Assert.ok(
|
||||
|
|
|
@ -49,7 +49,7 @@ add_task(async function testHTTPSSVC() {
|
|||
);
|
||||
}
|
||||
|
||||
let [, inRecord] = await new TRRDNSListener("test.httpssvc.com", {
|
||||
let { inRecord } = await new TRRDNSListener("test.httpssvc.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
let answer = inRecord.QueryInterface(Ci.nsIDNSHTTPSSVCRecord).records;
|
||||
|
@ -266,7 +266,7 @@ add_task(async function test_aliasform() {
|
|||
],
|
||||
});
|
||||
|
||||
let [, , inStatus] = await new TRRDNSListener("no-ip-host.com", {
|
||||
let { inStatus } = await new TRRDNSListener("no-ip-host.com", {
|
||||
expectedSuccess: false,
|
||||
});
|
||||
Assert.ok(
|
||||
|
@ -303,9 +303,9 @@ add_task(async function test_aliasform() {
|
|||
],
|
||||
});
|
||||
|
||||
[, , inStatus] = await new TRRDNSListener("loop.com", {
|
||||
({ inStatus } = await new TRRDNSListener("loop.com", {
|
||||
expectedSuccess: false,
|
||||
});
|
||||
}));
|
||||
Assert.ok(
|
||||
!Components.isSuccessCode(inStatus),
|
||||
`${inStatus} should be an error code`
|
||||
|
@ -328,9 +328,9 @@ add_task(async function test_aliasform() {
|
|||
],
|
||||
});
|
||||
|
||||
[, , inStatus] = await new TRRDNSListener("empty.com", {
|
||||
({ inStatus } = await new TRRDNSListener("empty.com", {
|
||||
expectedSuccess: false,
|
||||
});
|
||||
}));
|
||||
Assert.ok(
|
||||
!Components.isSuccessCode(inStatus),
|
||||
`${inStatus} should be an error code`
|
||||
|
@ -371,7 +371,7 @@ add_task(async function test_aliasform() {
|
|||
],
|
||||
});
|
||||
|
||||
let [, , inStatus2] = await new TRRDNSListener("multi.com", {
|
||||
let { inStatus: inStatus2 } = await new TRRDNSListener("multi.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
expectedSuccess: false,
|
||||
});
|
||||
|
@ -404,10 +404,10 @@ add_task(async function test_aliasform() {
|
|||
],
|
||||
});
|
||||
|
||||
[, , inStatus2] = await new TRRDNSListener("order.com", {
|
||||
({ inStatus: inStatus2 } = await new TRRDNSListener("order.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
expectedSuccess: false,
|
||||
});
|
||||
}));
|
||||
Assert.ok(
|
||||
!Components.isSuccessCode(inStatus2),
|
||||
`${inStatus2} should be an error code`
|
||||
|
@ -433,10 +433,10 @@ add_task(async function test_aliasform() {
|
|||
],
|
||||
});
|
||||
|
||||
[, , inStatus2] = await new TRRDNSListener("duplicate.com", {
|
||||
({ inStatus: inStatus2 } = await new TRRDNSListener("duplicate.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
expectedSuccess: false,
|
||||
});
|
||||
}));
|
||||
Assert.ok(
|
||||
!Components.isSuccessCode(inStatus2),
|
||||
`${inStatus2} should be an error code`
|
||||
|
@ -463,10 +463,10 @@ add_task(async function test_aliasform() {
|
|||
],
|
||||
});
|
||||
|
||||
[, , inStatus2] = await new TRRDNSListener("mandatory.com", {
|
||||
({ inStatus: inStatus2 } = await new TRRDNSListener("mandatory.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
expectedSuccess: false,
|
||||
});
|
||||
}));
|
||||
Assert.ok(!Components.isSuccessCode(inStatus2), `${inStatus2} should fail`);
|
||||
|
||||
// mandatory svcparam
|
||||
|
@ -504,9 +504,9 @@ add_task(async function test_aliasform() {
|
|||
],
|
||||
});
|
||||
|
||||
[, , inStatus2] = await new TRRDNSListener("mandatory2.com", {
|
||||
({ inStatus: inStatus2 } = await new TRRDNSListener("mandatory2.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
}));
|
||||
|
||||
Assert.ok(Components.isSuccessCode(inStatus2), `${inStatus2} should succeed`);
|
||||
|
||||
|
@ -527,10 +527,10 @@ add_task(async function test_aliasform() {
|
|||
],
|
||||
});
|
||||
|
||||
[, , inStatus2] = await new TRRDNSListener("no-alias.com", {
|
||||
({ inStatus: inStatus2 } = await new TRRDNSListener("no-alias.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
expectedSuccess: false,
|
||||
});
|
||||
}));
|
||||
|
||||
Assert.ok(!Components.isSuccessCode(inStatus2), `${inStatus2} should fail`);
|
||||
|
||||
|
@ -552,9 +552,9 @@ add_task(async function test_aliasform() {
|
|||
});
|
||||
|
||||
let inRecord;
|
||||
[, inRecord, inStatus2] = await new TRRDNSListener("service.com", {
|
||||
({ inRecord, inStatus: inStatus2 } = await new TRRDNSListener("service.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
}));
|
||||
Assert.ok(Components.isSuccessCode(inStatus2), `${inStatus2} should work`);
|
||||
let answer = inRecord.QueryInterface(Ci.nsIDNSHTTPSSVCRecord).records;
|
||||
Assert.equal(answer[0].priority, 1);
|
||||
|
@ -562,7 +562,7 @@ add_task(async function test_aliasform() {
|
|||
});
|
||||
|
||||
add_task(async function testNegativeResponse() {
|
||||
let [, , inStatus] = await new TRRDNSListener("negative_test.com", {
|
||||
let { inStatus } = await new TRRDNSListener("negative_test.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
expectedSuccess: false,
|
||||
});
|
||||
|
@ -588,10 +588,10 @@ add_task(async function testNegativeResponse() {
|
|||
});
|
||||
|
||||
// Should still be failed because a negative response is from DNS cache.
|
||||
[, , inStatus] = await new TRRDNSListener("negative_test.com", {
|
||||
({ inStatus } = await new TRRDNSListener("negative_test.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
expectedSuccess: false,
|
||||
});
|
||||
}));
|
||||
Assert.ok(
|
||||
!Components.isSuccessCode(inStatus),
|
||||
`${inStatus} should be an error code`
|
||||
|
@ -605,9 +605,9 @@ add_task(async function testNegativeResponse() {
|
|||
}
|
||||
|
||||
let inRecord;
|
||||
[, inRecord, inStatus] = await new TRRDNSListener("negative_test.com", {
|
||||
({ inRecord, inStatus } = await new TRRDNSListener("negative_test.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
}));
|
||||
Assert.ok(Components.isSuccessCode(inStatus), `${inStatus} should work`);
|
||||
let answer = inRecord.QueryInterface(Ci.nsIDNSHTTPSSVCRecord).records;
|
||||
Assert.equal(answer[0].priority, 1);
|
||||
|
|
|
@ -96,7 +96,7 @@ add_task(async function test_add_nat64_prefix_to_trr() {
|
|||
},
|
||||
],
|
||||
});
|
||||
let [, inRecord] = await new TRRDNSListener("xyz.foo", {
|
||||
let { inRecord } = await new TRRDNSListener("xyz.foo", {
|
||||
expectedSuccess: false,
|
||||
});
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ add_task(async function testFallback() {
|
|||
],
|
||||
});
|
||||
|
||||
let [, inRecord] = await new TRRDNSListener("test.fallback.com", {
|
||||
let { inRecord } = await new TRRDNSListener("test.fallback.com", {
|
||||
type: dns.RESOLVE_TYPE_HTTPSSVC,
|
||||
});
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ async function test_A_record() {
|
|||
setModeAndURI(3, "doh?responseIP=4.4.4.4&auth=true");
|
||||
Services.prefs.setCharPref("network.trr.credentials", "evil:person");
|
||||
|
||||
let [, , inStatus] = await new TRRDNSListener(
|
||||
let { inStatus } = await new TRRDNSListener(
|
||||
"wrong.example.com",
|
||||
undefined,
|
||||
false
|
||||
|
@ -139,7 +139,7 @@ async function test_RFC1918() {
|
|||
dns.clearCache(true);
|
||||
setModeAndURI(3, "doh?responseIP=192.168.0.1");
|
||||
|
||||
let [, , inStatus] = await new TRRDNSListener(
|
||||
let { inStatus } = await new TRRDNSListener(
|
||||
"rfc1918.example.com",
|
||||
undefined,
|
||||
false
|
||||
|
@ -150,11 +150,11 @@ async function test_RFC1918() {
|
|||
`${inStatus} should be an error code`
|
||||
);
|
||||
setModeAndURI(3, "doh?responseIP=::ffff:192.168.0.1");
|
||||
[, , inStatus] = await new TRRDNSListener(
|
||||
({ inStatus } = await new TRRDNSListener(
|
||||
"rfc1918-ipv6.example.com",
|
||||
undefined,
|
||||
false
|
||||
);
|
||||
));
|
||||
Assert.ok(
|
||||
!Components.isSuccessCode(inStatus),
|
||||
`${inStatus} should be an error code`
|
||||
|
@ -209,7 +209,7 @@ async function test_timeout_mode3() {
|
|||
Services.prefs.setIntPref("network.trr.request_timeout_ms", 10);
|
||||
Services.prefs.setIntPref("network.trr.request_timeout_mode_trronly_ms", 10);
|
||||
|
||||
let [, , inStatus] = await new TRRDNSListener(
|
||||
let { inStatus } = await new TRRDNSListener(
|
||||
"timeout.example.com",
|
||||
undefined,
|
||||
false
|
||||
|
@ -238,7 +238,7 @@ async function test_strict_native_fallback() {
|
|||
Services.prefs.setIntPref("network.trr.request_timeout_ms", 10);
|
||||
Services.prefs.setIntPref("network.trr.request_timeout_mode_trronly_ms", 10);
|
||||
|
||||
let [, , inStatus] = await new TRRDNSListener(
|
||||
let { inStatus } = await new TRRDNSListener(
|
||||
"timeout.example.com",
|
||||
undefined,
|
||||
false
|
||||
|
@ -253,7 +253,7 @@ async function test_strict_native_fallback() {
|
|||
setModeAndURI(2, "doh?responseIP=2.2.2.2");
|
||||
Services.prefs.clearUserPref("network.trr.request_timeout_ms");
|
||||
Services.prefs.clearUserPref("network.trr.request_timeout_mode_trronly_ms");
|
||||
[, , inStatus] = await new TRRDNSListener("closeme.com", undefined, false);
|
||||
({ inStatus } = await new TRRDNSListener("closeme.com", undefined, false));
|
||||
Assert.ok(
|
||||
!Components.isSuccessCode(inStatus),
|
||||
`${inStatus} should be an error code`
|
||||
|
@ -262,11 +262,11 @@ async function test_strict_native_fallback() {
|
|||
info("Now a decode error");
|
||||
dns.clearCache(true);
|
||||
setModeAndURI(2, "doh?responseIP=2.2.2.2&corruptedAnswer=true");
|
||||
[, , inStatus] = await new TRRDNSListener(
|
||||
({ inStatus } = await new TRRDNSListener(
|
||||
"bar.example.com",
|
||||
undefined,
|
||||
false
|
||||
);
|
||||
));
|
||||
Assert.ok(
|
||||
!Components.isSuccessCode(inStatus),
|
||||
`${inStatus} should be an error code`
|
||||
|
@ -400,7 +400,7 @@ async function test_CNAME() {
|
|||
setModeAndURI(3, "doh?responseIP=none&cnameloop=true");
|
||||
}
|
||||
|
||||
let [, , inStatus] = await new TRRDNSListener(
|
||||
let { inStatus } = await new TRRDNSListener(
|
||||
"test18.example.com",
|
||||
undefined,
|
||||
false
|
||||
|
@ -439,7 +439,7 @@ async function test_name_mismatch() {
|
|||
// regardless of what was requested.
|
||||
setModeAndURI(3, "doh?hostname=mismatch.example.com");
|
||||
|
||||
let [, , inStatus] = await new TRRDNSListener(
|
||||
let { inStatus } = await new TRRDNSListener(
|
||||
"bar.example.com",
|
||||
undefined,
|
||||
false
|
||||
|
@ -718,11 +718,7 @@ async function test_connection_closed() {
|
|||
await new TRRDNSListener("bar.example.com", "2.2.2.2");
|
||||
|
||||
// makes the TRR connection shut down.
|
||||
let [, , inStatus] = await new TRRDNSListener(
|
||||
"closeme.com",
|
||||
undefined,
|
||||
false
|
||||
);
|
||||
let { inStatus } = await new TRRDNSListener("closeme.com", undefined, false);
|
||||
Assert.ok(
|
||||
!Components.isSuccessCode(inStatus),
|
||||
`${inStatus} should be an error code`
|
||||
|
@ -739,7 +735,7 @@ async function test_connection_closed() {
|
|||
await new TRRDNSListener("bar.example.com", "2.2.2.2");
|
||||
|
||||
// makes the TRR connection shut down.
|
||||
[, , inStatus] = await new TRRDNSListener("closeme.com", undefined, false);
|
||||
({ inStatus } = await new TRRDNSListener("closeme.com", undefined, false));
|
||||
Assert.ok(
|
||||
!Components.isSuccessCode(inStatus),
|
||||
`${inStatus} should be an error code`
|
||||
|
@ -755,7 +751,7 @@ async function test_connection_closed() {
|
|||
await new TRRDNSListener("bar.example.com", "2.2.2.2");
|
||||
|
||||
// makes the TRR connection shut down.
|
||||
[, , inStatus] = await new TRRDNSListener("closeme.com", undefined, false);
|
||||
({ inStatus } = await new TRRDNSListener("closeme.com", undefined, false));
|
||||
Assert.ok(
|
||||
!Components.isSuccessCode(inStatus),
|
||||
`${inStatus} should be an error code`
|
||||
|
@ -774,7 +770,7 @@ async function test_connection_closed() {
|
|||
await new TRRDNSListener("bar.example.com", "2.2.2.2");
|
||||
|
||||
// makes the TRR connection shut down.
|
||||
[, , inStatus] = await new TRRDNSListener("closeme.com", undefined, false);
|
||||
({ inStatus } = await new TRRDNSListener("closeme.com", undefined, false));
|
||||
Assert.ok(
|
||||
!Components.isSuccessCode(inStatus),
|
||||
`${inStatus} should be an error code`
|
||||
|
|
|
@ -15,7 +15,7 @@ let test_answer_addr = "127.0.0.1";
|
|||
|
||||
add_task(async function testTXTResolve() {
|
||||
// use the h2 server as DOH provider
|
||||
let [, inRecord, inStatus] = await new TRRDNSListener("_esni.example.com", {
|
||||
let { inRecord, inStatus } = await new TRRDNSListener("_esni.example.com", {
|
||||
type: dns.RESOLVE_TYPE_TXT,
|
||||
});
|
||||
Assert.equal(inStatus, Cr.NS_OK, "status OK");
|
||||
|
|
Загрузка…
Ссылка в новой задаче