5 var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
7 for (var i = 0; i < 20; i++) {
8 hostname1 += possible.charAt(Math.floor(Math.random() * possible.length));
9 hostname2 += possible.charAt(Math.floor(Math.random() * possible.length));
12 var requestList1Canceled2;
13 var requestList1NotCanceled;
15 var requestList2Canceled;
16 var requestList2NotCanceled;
19 onLookupComplete(inRequest, inRecord, inStatus) {
20 // One request should be resolved and two request should be canceled.
21 if (inRequest == requestList1NotCanceled) {
22 // This request should not be canceled.
23 Assert.notEqual(inStatus, Cr.NS_ERROR_ABORT);
28 QueryInterface: ChromeUtils.generateQI(["nsIDNSListener"]),
32 onLookupComplete(inRequest, inRecord, inStatus) {
33 // One request should be resolved and the other canceled.
34 if (inRequest == requestList2NotCanceled) {
35 // The request should not be canceled.
36 Assert.notEqual(inStatus, Cr.NS_ERROR_ABORT);
41 QueryInterface: ChromeUtils.generateQI(["nsIDNSListener"]),
44 const defaultOriginAttributes = {};
47 var mainThread = Services.tm.currentThread;
49 var flags = Ci.nsIDNSService.RESOLVE_BYPASS_CACHE;
51 // This one will be canceled with cancelAsyncResolve.
52 Services.dns.asyncResolve(
54 Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
59 defaultOriginAttributes
61 Services.dns.cancelAsyncResolve(
63 Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
68 defaultOriginAttributes
71 // This one will not be canceled.
72 requestList1NotCanceled = Services.dns.asyncResolve(
74 Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
79 defaultOriginAttributes
82 // This one will be canceled with cancel(Cr.NS_ERROR_ABORT).
83 requestList1Canceled2 = Services.dns.asyncResolve(
85 Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
90 defaultOriginAttributes
92 requestList1Canceled2.cancel(Cr.NS_ERROR_ABORT);
94 // This one will not be canceled.
95 requestList2NotCanceled = Services.dns.asyncResolve(
97 Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
102 defaultOriginAttributes
105 // This one will be canceled with cancel(Cr.NS_ERROR_ABORT).
106 requestList2Canceled = Services.dns.asyncResolve(
108 Ci.nsIDNSService.RESOLVE_TYPE_DEFAULT,
110 null, // resolverInfo
113 defaultOriginAttributes
115 requestList2Canceled.cancel(Cr.NS_ERROR_ABORT);