forked from mirrors/gecko-dev
Bug 1850244 - Fix remaining ESLint no-shadow issues in netwerk/test. r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D186880
This commit is contained in:
parent
1f31fc99fb
commit
4c0d6044cb
46 changed files with 224 additions and 267 deletions
|
|
@ -211,12 +211,6 @@ module.exports = {
|
||||||
...testPaths.chrome.map(path => `${path}/**/*.js`),
|
...testPaths.chrome.map(path => `${path}/**/*.js`),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
files: ["netwerk/test/mochitests/**", "netwerk/test/unit*/**"],
|
|
||||||
rules: {
|
|
||||||
"no-shadow": "warn",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
// Bug 877389 - Gradually migrate from Cu.reportError to console.error.
|
// Bug 877389 - Gradually migrate from Cu.reportError to console.error.
|
||||||
// Enable these as we fix more areas.
|
// Enable these as we fix more areas.
|
||||||
|
|
|
||||||
|
|
@ -361,7 +361,7 @@ function trrQueryHandler(req, resp, url) {
|
||||||
resp.end("Unexpected method");
|
resp.end("Unexpected method");
|
||||||
}
|
}
|
||||||
|
|
||||||
function processRequest(req, resp, payload) {
|
function processRequest(req1, resp1, payload) {
|
||||||
let dnsQuery = global.dnsPacket.decode(payload);
|
let dnsQuery = global.dnsPacket.decode(payload);
|
||||||
let domain = dnsQuery.questions[0].name;
|
let domain = dnsQuery.questions[0].name;
|
||||||
let type = dnsQuery.questions[0].type;
|
let type = dnsQuery.questions[0].type;
|
||||||
|
|
@ -387,24 +387,24 @@ function trrQueryHandler(req, resp, url) {
|
||||||
additionals: response.additionals || [],
|
additionals: response.additionals || [],
|
||||||
});
|
});
|
||||||
|
|
||||||
let writeResponse = (resp, buf, context) => {
|
let writeResponse = (resp2, buf2, context) => {
|
||||||
try {
|
try {
|
||||||
if (context.error) {
|
if (context.error) {
|
||||||
// If the error is a valid HTTP response number just write it out.
|
// If the error is a valid HTTP response number just write it out.
|
||||||
if (context.error < 600) {
|
if (context.error < 600) {
|
||||||
resp.writeHead(context.error);
|
resp2.writeHead(context.error);
|
||||||
resp.end("Intentional error");
|
resp2.end("Intentional error");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bigger error means force close the session
|
// Bigger error means force close the session
|
||||||
req.stream.session.close();
|
req1.stream.session.close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
resp.setHeader("Content-Length", buf.length);
|
resp2.setHeader("Content-Length", buf2.length);
|
||||||
resp.writeHead(200, { "Content-Type": "application/dns-message" });
|
resp2.writeHead(200, { "Content-Type": "application/dns-message" });
|
||||||
resp.write(buf);
|
resp2.write(buf2);
|
||||||
resp.end("");
|
resp2.end("");
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -417,12 +417,12 @@ function trrQueryHandler(req, resp, url) {
|
||||||
writeResponse(arg[0], arg[1], arg[2]);
|
writeResponse(arg[0], arg[1], arg[2]);
|
||||||
},
|
},
|
||||||
response.delay,
|
response.delay,
|
||||||
[resp, buf, response]
|
[resp1, buf, response]
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
writeResponse(resp, buf, response);
|
writeResponse(resp1, buf, response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -134,12 +134,12 @@ function promiseVerifyContents(aFile, aExpectedContents) {
|
||||||
function promiseSaverComplete(aSaver, aOnTargetChangeFn) {
|
function promiseSaverComplete(aSaver, aOnTargetChangeFn) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
aSaver.observer = {
|
aSaver.observer = {
|
||||||
onTargetChange: function BFSO_onSaveComplete(aSaver, aTarget) {
|
onTargetChange: function BFSO_onSaveComplete(saver, aTarget) {
|
||||||
if (aOnTargetChangeFn) {
|
if (aOnTargetChangeFn) {
|
||||||
aOnTargetChangeFn(aTarget);
|
aOnTargetChangeFn(aTarget);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onSaveComplete: function BFSO_onSaveComplete(aSaver, aStatus) {
|
onSaveComplete: function BFSO_onSaveComplete(saver, aStatus) {
|
||||||
if (Components.isSuccessCode(aStatus)) {
|
if (Components.isSuccessCode(aStatus)) {
|
||||||
resolve();
|
resolve();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -9,28 +9,28 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW, "a1m", "a1d", function (entry) {
|
new OpenCallback(NEW, "a1m", "a1d", function () {
|
||||||
// Open for read and check
|
// Open for read and check
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://a/",
|
"http://a/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NORMAL, "a1m", "a1d", function (entry) {
|
new OpenCallback(NORMAL, "a1m", "a1d", function () {
|
||||||
// Open but don't want the entry
|
// Open but don't want the entry
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://a/",
|
"http://a/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NOTWANTED, "a1m", "a1d", function (entry) {
|
new OpenCallback(NOTWANTED, "a1m", "a1d", function () {
|
||||||
// Open for read again and check the entry is OK
|
// Open for read again and check the entry is OK
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://a/",
|
"http://a/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NORMAL, "a1m", "a1d", function (entry) {
|
new OpenCallback(NORMAL, "a1m", "a1d", function () {
|
||||||
finish_cache2_test();
|
finish_cache2_test();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW | DONTFILL, "a1m", "a1d", function (entry) {
|
new OpenCallback(NEW | DONTFILL, "a1m", "a1d", function () {
|
||||||
var bypassed = false;
|
var bypassed = false;
|
||||||
|
|
||||||
// Open and bypass
|
// Open and bypass
|
||||||
|
|
@ -18,7 +18,7 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_BYPASS_IF_BUSY,
|
Ci.nsICacheStorage.OPEN_BYPASS_IF_BUSY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NOTFOUND, "", "", function (entry) {
|
new OpenCallback(NOTFOUND, "", "", function () {
|
||||||
Assert.ok(!bypassed);
|
Assert.ok(!bypassed);
|
||||||
bypassed = true;
|
bypassed = true;
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -9,28 +9,28 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_READONLY,
|
Ci.nsICacheStorage.OPEN_READONLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NOTFOUND, null, null, function (entry) {
|
new OpenCallback(NOTFOUND, null, null, function () {
|
||||||
// Open the same non-existing for read again, should fail second time
|
// Open the same non-existing for read again, should fail second time
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://b/",
|
"http://b/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_READONLY,
|
Ci.nsICacheStorage.OPEN_READONLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NOTFOUND, null, null, function (entry) {
|
new OpenCallback(NOTFOUND, null, null, function () {
|
||||||
// Try it again normally, should go
|
// Try it again normally, should go
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://b/",
|
"http://b/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW, "b1m", "b1d", function (entry) {
|
new OpenCallback(NEW, "b1m", "b1d", function () {
|
||||||
// ...and check
|
// ...and check
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://b/",
|
"http://b/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NORMAL, "b1m", "b1d", function (entry) {
|
new OpenCallback(NORMAL, "b1m", "b1d", function () {
|
||||||
finish_cache2_test();
|
finish_cache2_test();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -9,21 +9,21 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW | THROWAVAIL, null, null, function (entry) {
|
new OpenCallback(NEW | THROWAVAIL, null, null, function () {
|
||||||
// Try it again, should go
|
// Try it again, should go
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://c/",
|
"http://c/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW, "c1m", "c1d", function (entry) {
|
new OpenCallback(NEW, "c1m", "c1d", function () {
|
||||||
// ...and check
|
// ...and check
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://c/",
|
"http://c/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(false, "c1m", "c1d", function (entry) {
|
new OpenCallback(false, "c1m", "c1d", function () {
|
||||||
finish_cache2_test();
|
finish_cache2_test();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -9,28 +9,28 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW | THROWAVAIL, null, null, function (entry) {
|
new OpenCallback(NEW | THROWAVAIL, null, null, function () {
|
||||||
// Open but let OCEA throw ones again
|
// Open but let OCEA throw ones again
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://d/",
|
"http://d/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW | THROWAVAIL, null, null, function (entry) {
|
new OpenCallback(NEW | THROWAVAIL, null, null, function () {
|
||||||
// Try it again, should go
|
// Try it again, should go
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://d/",
|
"http://d/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW, "d1m", "d1d", function (entry) {
|
new OpenCallback(NEW, "d1m", "d1d", function () {
|
||||||
// ...and check
|
// ...and check
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://d/",
|
"http://d/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NORMAL, "d1m", "d1d", function (entry) {
|
new OpenCallback(NORMAL, "d1m", "d1d", function () {
|
||||||
finish_cache2_test();
|
finish_cache2_test();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -42,13 +42,13 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW, "a1m", "a1d", function (entry) {
|
new OpenCallback(NEW, "a1m", "a1d", function () {
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://a/",
|
"http://a/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NORMAL, "a1m", "a1d", function (entry) {
|
new OpenCallback(NORMAL, "a1m", "a1d", function () {
|
||||||
mc.fired();
|
mc.fired();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
@ -60,13 +60,13 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW, "b1m", "b1d", function (entry) {
|
new OpenCallback(NEW, "b1m", "b1d", function () {
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://b/",
|
"http://b/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NORMAL, "b1m", "b1d", function (entry) {
|
new OpenCallback(NORMAL, "b1m", "b1d", function () {
|
||||||
mc.fired();
|
mc.fired();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
@ -78,13 +78,13 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW, "c1m", "c1d", function (entry) {
|
new OpenCallback(NEW, "c1m", "c1d", function () {
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://c/",
|
"http://c/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NORMAL, "c1m", "c1d", function (entry) {
|
new OpenCallback(NORMAL, "c1m", "c1d", function () {
|
||||||
mc.fired();
|
mc.fired();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
@ -96,13 +96,13 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW, "d1m", "d1d", function (entry) {
|
new OpenCallback(NEW, "d1m", "d1d", function () {
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://d/",
|
"http://d/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NORMAL, "d1m", "d1d", function (entry) {
|
new OpenCallback(NORMAL, "d1m", "d1d", function () {
|
||||||
mc.fired();
|
mc.fired();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -13,13 +13,13 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
Services.loadContextInfo.private,
|
Services.loadContextInfo.private,
|
||||||
new OpenCallback(NEW, "p1m", "p1d", function (entry) {
|
new OpenCallback(NEW, "p1m", "p1d", function () {
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://p1/",
|
"http://p1/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
Services.loadContextInfo.private,
|
Services.loadContextInfo.private,
|
||||||
new OpenCallback(NORMAL, "p1m", "p1d", function (entry) {
|
new OpenCallback(NORMAL, "p1m", "p1d", function () {
|
||||||
// Check it's there
|
// Check it's there
|
||||||
syncWithCacheIOThread(function () {
|
syncWithCacheIOThread(function () {
|
||||||
var storage = getCacheStorage(
|
var storage = getCacheStorage(
|
||||||
|
|
|
||||||
|
|
@ -34,13 +34,13 @@ function run_test() {
|
||||||
"memory",
|
"memory",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW, "m1m", "m1d", function (entry) {
|
new OpenCallback(NEW, "m1m", "m1d", function () {
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://mem1/",
|
"http://mem1/",
|
||||||
"memory",
|
"memory",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NORMAL, "m1m", "m1d", function (entry) {
|
new OpenCallback(NORMAL, "m1m", "m1d", function () {
|
||||||
mc.fired();
|
mc.fired();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
@ -52,13 +52,13 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW, "a1m", "a1d", function (entry) {
|
new OpenCallback(NEW, "a1m", "a1d", function () {
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://a/",
|
"http://a/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NORMAL, "a1m", "a1d", function (entry) {
|
new OpenCallback(NORMAL, "a1m", "a1d", function () {
|
||||||
mc.fired();
|
mc.fired();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
@ -70,13 +70,13 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW, "a1m", "a1d", function (entry) {
|
new OpenCallback(NEW, "a1m", "a1d", function () {
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://b/",
|
"http://b/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NORMAL, "a1m", "a1d", function (entry) {
|
new OpenCallback(NORMAL, "a1m", "a1d", function () {
|
||||||
mc.fired();
|
mc.fired();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
@ -88,13 +88,13 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW, "a1m", "a1d", function (entry) {
|
new OpenCallback(NEW, "a1m", "a1d", function () {
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://c/",
|
"http://c/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NORMAL, "a1m", "a1d", function (entry) {
|
new OpenCallback(NORMAL, "a1m", "a1d", function () {
|
||||||
mc.fired();
|
mc.fired();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
@ -106,13 +106,13 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW, "a1m", "a1d", function (entry) {
|
new OpenCallback(NEW, "a1m", "a1d", function () {
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://d/",
|
"http://d/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NORMAL, "a1m", "a1d", function (entry) {
|
new OpenCallback(NORMAL, "a1m", "a1d", function () {
|
||||||
mc.fired();
|
mc.fired();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,13 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW, "a1m", "a1d", function (entry) {
|
new OpenCallback(NEW, "a1m", "a1d", function () {
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://a/",
|
"http://a/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NORMAL, "a1m", "a1d", function (entry) {
|
new OpenCallback(NORMAL, "a1m", "a1d", function () {
|
||||||
var storage = getCacheStorage("disk");
|
var storage = getCacheStorage("disk");
|
||||||
storage.asyncDoomURI(
|
storage.asyncDoomURI(
|
||||||
createURI("http://a/"),
|
createURI("http://a/"),
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW, "b1m", "b1d", function (entry) {
|
new OpenCallback(NEW, "b1m", "b1d", function () {
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://b/",
|
"http://b/",
|
||||||
"disk",
|
"disk",
|
||||||
|
|
|
||||||
|
|
@ -3,17 +3,17 @@
|
||||||
function run_test() {
|
function run_test() {
|
||||||
do_get_profile();
|
do_get_profile();
|
||||||
|
|
||||||
var storage = getCacheStorage("memory");
|
var memoryStorage = getCacheStorage("memory");
|
||||||
var mc = new MultipleCallbacks(3, function () {
|
var mc = new MultipleCallbacks(3, function () {
|
||||||
storage.asyncEvictStorage(
|
memoryStorage.asyncEvictStorage(
|
||||||
new EvictionCallback(true, function () {
|
new EvictionCallback(true, function () {
|
||||||
storage.asyncVisitStorage(
|
memoryStorage.asyncVisitStorage(
|
||||||
new VisitCallback(0, 0, [], function () {
|
new VisitCallback(0, 0, [], function () {
|
||||||
var storage = getCacheStorage("disk");
|
var diskStorage = getCacheStorage("disk");
|
||||||
|
|
||||||
var expectedConsumption = 2048;
|
var expectedConsumption = 2048;
|
||||||
|
|
||||||
storage.asyncVisitStorage(
|
diskStorage.asyncVisitStorage(
|
||||||
new VisitCallback(
|
new VisitCallback(
|
||||||
2,
|
2,
|
||||||
expectedConsumption,
|
expectedConsumption,
|
||||||
|
|
@ -36,13 +36,13 @@ function run_test() {
|
||||||
"memory",
|
"memory",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW, "m2m", "m2d", function (entry) {
|
new OpenCallback(NEW, "m2m", "m2d", function () {
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://mem1/",
|
"http://mem1/",
|
||||||
"memory",
|
"memory",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NORMAL, "m2m", "m2d", function (entry) {
|
new OpenCallback(NORMAL, "m2m", "m2d", function () {
|
||||||
mc.fired();
|
mc.fired();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
@ -54,13 +54,13 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW, "a1m", "a1d", function (entry) {
|
new OpenCallback(NEW, "a1m", "a1d", function () {
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://a/",
|
"http://a/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NORMAL, "a1m", "a1d", function (entry) {
|
new OpenCallback(NORMAL, "a1m", "a1d", function () {
|
||||||
mc.fired();
|
mc.fired();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
@ -72,13 +72,13 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW, "a1m", "a1d", function (entry) {
|
new OpenCallback(NEW, "a1m", "a1d", function () {
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://b/",
|
"http://b/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NORMAL, "a1m", "a1d", function (entry) {
|
new OpenCallback(NORMAL, "a1m", "a1d", function () {
|
||||||
mc.fired();
|
mc.fired();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,13 @@ function run_test() {
|
||||||
do_get_profile();
|
do_get_profile();
|
||||||
|
|
||||||
var mc = new MultipleCallbacks(3, function () {
|
var mc = new MultipleCallbacks(3, function () {
|
||||||
var storage = getCacheStorage("disk");
|
var diskStorage = getCacheStorage("disk");
|
||||||
storage.asyncEvictStorage(
|
diskStorage.asyncEvictStorage(
|
||||||
new EvictionCallback(true, function () {
|
new EvictionCallback(true, function () {
|
||||||
storage.asyncVisitStorage(
|
diskStorage.asyncVisitStorage(
|
||||||
new VisitCallback(0, 0, [], function () {
|
new VisitCallback(0, 0, [], function () {
|
||||||
var storage = getCacheStorage("memory");
|
var memoryStorage = getCacheStorage("memory");
|
||||||
storage.asyncVisitStorage(
|
memoryStorage.asyncVisitStorage(
|
||||||
new VisitCallback(0, 0, [], function () {
|
new VisitCallback(0, 0, [], function () {
|
||||||
finish_cache2_test();
|
finish_cache2_test();
|
||||||
}),
|
}),
|
||||||
|
|
@ -28,13 +28,13 @@ function run_test() {
|
||||||
"memory",
|
"memory",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW, "m2m", "m2d", function (entry) {
|
new OpenCallback(NEW, "m2m", "m2d", function () {
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://mem1/",
|
"http://mem1/",
|
||||||
"memory",
|
"memory",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NORMAL, "m2m", "m2d", function (entry) {
|
new OpenCallback(NORMAL, "m2m", "m2d", function () {
|
||||||
mc.fired();
|
mc.fired();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
@ -46,13 +46,13 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW, "a1m", "a1d", function (entry) {
|
new OpenCallback(NEW, "a1m", "a1d", function () {
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://a/",
|
"http://a/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NORMAL, "a1m", "a1d", function (entry) {
|
new OpenCallback(NORMAL, "a1m", "a1d", function () {
|
||||||
mc.fired();
|
mc.fired();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
@ -64,13 +64,13 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW, "b1m", "b1d", function (entry) {
|
new OpenCallback(NEW, "b1m", "b1d", function () {
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://b/",
|
"http://b/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NORMAL, "b1m", "b1d", function (entry) {
|
new OpenCallback(NORMAL, "b1m", "b1d", function () {
|
||||||
mc.fired();
|
mc.fired();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW, "31m", "31d", function (entry) {
|
new OpenCallback(NEW, "31m", "31d", function () {
|
||||||
// Open normally but wait for validation from the server
|
// Open normally but wait for validation from the server
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://304/",
|
"http://304/",
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,13 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW, "21m", "21d", function (entry) {
|
new OpenCallback(NEW, "21m", "21d", function () {
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://200/",
|
"http://200/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NORMAL, "21m", "21d", function (entry) {
|
new OpenCallback(NORMAL, "21m", "21d", function () {
|
||||||
// Open normally but wait for validation from the server
|
// Open normally but wait for validation from the server
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://200/",
|
"http://200/",
|
||||||
|
|
|
||||||
|
|
@ -11,21 +11,21 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW | DOOMED, "v1m", "v1d", function (entry) {
|
new OpenCallback(NEW | DOOMED, "v1m", "v1d", function () {
|
||||||
// Open for rewrite (don't validate), write different meta and data
|
// Open for rewrite (don't validate), write different meta and data
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://nv/",
|
"http://nv/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NOTVALID | RECREATE, "v2m", "v2d", function (entry) {
|
new OpenCallback(NOTVALID | RECREATE, "v2m", "v2d", function () {
|
||||||
// And check...
|
// And check...
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://nv/",
|
"http://nv/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NORMAL, "v2m", "v2d", function (entry) {
|
new OpenCallback(NORMAL, "v2m", "v2d", function () {
|
||||||
finish_cache2_test();
|
finish_cache2_test();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW, "206m", "206part1-", function (entry) {
|
new OpenCallback(NEW, "206m", "206part1-", function () {
|
||||||
// Open normally but wait for validation from the server
|
// Open normally but wait for validation from the server
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://r206/",
|
"http://r206/",
|
||||||
|
|
@ -22,8 +22,8 @@ function run_test() {
|
||||||
NEW | WAITFORWRITE | PARTIAL,
|
NEW | WAITFORWRITE | PARTIAL,
|
||||||
"206m",
|
"206m",
|
||||||
"-part2",
|
"-part2",
|
||||||
function (entry) {
|
function (entry1) {
|
||||||
entry.setValid();
|
entry1.setValid();
|
||||||
}
|
}
|
||||||
).onCacheEntryAvailable(entry, true, Cr.NS_OK);
|
).onCacheEntryAvailable(entry, true, Cr.NS_OK);
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW, "200m1", "200part1a-", function (entry) {
|
new OpenCallback(NEW, "200m1", "200part1a-", function () {
|
||||||
// Open normally but wait for validation from the server
|
// Open normally but wait for validation from the server
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://r200/",
|
"http://r200/",
|
||||||
|
|
@ -23,8 +23,8 @@ function run_test() {
|
||||||
NEW | WAITFORWRITE | RECREATE,
|
NEW | WAITFORWRITE | RECREATE,
|
||||||
"200m2",
|
"200m2",
|
||||||
"200part1b--part2b",
|
"200part1b--part2b",
|
||||||
function (entry) {
|
function (entry1) {
|
||||||
entry.setValid();
|
entry1.setValid();
|
||||||
}
|
}
|
||||||
).onCacheEntryAvailable(entry, true, Cr.NS_OK);
|
).onCacheEntryAvailable(entry, true, Cr.NS_OK);
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -9,33 +9,33 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
Services.loadContextInfo.anonymous,
|
Services.loadContextInfo.anonymous,
|
||||||
new OpenCallback(NEW, "an1", "an1", function (entry) {
|
new OpenCallback(NEW, "an1", "an1", function () {
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://anon1/",
|
"http://anon1/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
Services.loadContextInfo.anonymous,
|
Services.loadContextInfo.anonymous,
|
||||||
new OpenCallback(NORMAL, "an1", "an1", function (entry) {
|
new OpenCallback(NORMAL, "an1", "an1", function () {
|
||||||
// Create and check an entry non-anon disk storage
|
// Create and check an entry non-anon disk storage
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://anon1/",
|
"http://anon1/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
Services.loadContextInfo.default,
|
Services.loadContextInfo.default,
|
||||||
new OpenCallback(NEW, "na1", "na1", function (entry) {
|
new OpenCallback(NEW, "na1", "na1", function () {
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://anon1/",
|
"http://anon1/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
Services.loadContextInfo.default,
|
Services.loadContextInfo.default,
|
||||||
new OpenCallback(NORMAL, "na1", "na1", function (entry) {
|
new OpenCallback(NORMAL, "na1", "na1", function () {
|
||||||
// check the anon entry is still there and intact
|
// check the anon entry is still there and intact
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://anon1/",
|
"http://anon1/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
Services.loadContextInfo.anonymous,
|
Services.loadContextInfo.anonymous,
|
||||||
new OpenCallback(NORMAL, "an1", "an1", function (entry) {
|
new OpenCallback(NORMAL, "an1", "an1", function () {
|
||||||
finish_cache2_test();
|
finish_cache2_test();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -36,9 +36,9 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
function (status, entry) {
|
function (status1, entry1) {
|
||||||
Assert.equal(status, Cr.NS_OK);
|
Assert.equal(status1, Cr.NS_OK);
|
||||||
var oStr2 = entry.openOutputStream(0, data.length);
|
var oStr2 = entry1.openOutputStream(0, data.length);
|
||||||
do_check_throws_nsIException(
|
do_check_throws_nsIException(
|
||||||
() => oStr2.write(data, data.length),
|
() => oStr2.write(data, data.length),
|
||||||
"NS_ERROR_OUT_OF_MEMORY"
|
"NS_ERROR_OUT_OF_MEMORY"
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ function run_test() {
|
||||||
NEW | METAONLY | DONTSETVALID | WAITFORWRITE,
|
NEW | METAONLY | DONTSETVALID | WAITFORWRITE,
|
||||||
"meta",
|
"meta",
|
||||||
"",
|
"",
|
||||||
function (entry) {
|
function () {
|
||||||
// Open again, we must get the callback and zero-length data
|
// Open again, we must get the callback and zero-length data
|
||||||
executeSoon(() => {
|
executeSoon(() => {
|
||||||
Cu.forceGC(); // invokes OnHandleClosed on the entry
|
Cu.forceGC(); // invokes OnHandleClosed on the entry
|
||||||
|
|
@ -23,7 +23,7 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NORMAL, "meta", "", function (entry) {
|
new OpenCallback(NORMAL, "meta", "", function () {
|
||||||
finish_cache2_test();
|
finish_cache2_test();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,11 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NORMAL, "m", "d", function (entry) {
|
new OpenCallback(NORMAL, "m", "d", function (entry1) {
|
||||||
var secondOpen = NowSeconds();
|
var secondOpen = NowSeconds();
|
||||||
Assert.equal(entry.fetchCount, 2);
|
Assert.equal(entry1.fetchCount, 2);
|
||||||
do_check_time(entry.lastFetched, firstOpen, secondOpen);
|
do_check_time(entry1.lastFetched, firstOpen, secondOpen);
|
||||||
do_check_time(entry.lastModified, timeStart, firstOpen);
|
do_check_time(entry1.lastModified, timeStart, firstOpen);
|
||||||
|
|
||||||
finish_cache2_test();
|
finish_cache2_test();
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,10 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_SECRETLY,
|
Ci.nsICacheStorage.OPEN_SECRETLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NORMAL, "m", "d", function (entry) {
|
new OpenCallback(NORMAL, "m", "d", function (entry1) {
|
||||||
Assert.equal(entry.fetchCount, 1);
|
Assert.equal(entry1.fetchCount, 1);
|
||||||
do_check_time(entry.lastFetched, now1);
|
do_check_time(entry1.lastFetched, now1);
|
||||||
do_check_time(entry.lastModified, now1);
|
do_check_time(entry1.lastModified, now1);
|
||||||
|
|
||||||
finish_cache2_test();
|
finish_cache2_test();
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -9,14 +9,14 @@ function run_test() {
|
||||||
"pin",
|
"pin",
|
||||||
Ci.nsICacheStorage.OPEN_TRUNCATE,
|
Ci.nsICacheStorage.OPEN_TRUNCATE,
|
||||||
Services.loadContextInfo.default,
|
Services.loadContextInfo.default,
|
||||||
new OpenCallback(NEW | WAITFORWRITE, "a1m", "a1d", function (entry) {
|
new OpenCallback(NEW | WAITFORWRITE, "a1m", "a1d", function () {
|
||||||
// Open for read and check
|
// Open for read and check
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://a/",
|
"http://a/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
Services.loadContextInfo.default,
|
Services.loadContextInfo.default,
|
||||||
new OpenCallback(NORMAL, "a1m", "a1d", function (entry) {
|
new OpenCallback(NORMAL, "a1m", "a1d", function () {
|
||||||
// Now clear the whole cache
|
// Now clear the whole cache
|
||||||
Services.cache2.clear();
|
Services.cache2.clear();
|
||||||
|
|
||||||
|
|
@ -26,7 +26,7 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
Services.loadContextInfo.default,
|
Services.loadContextInfo.default,
|
||||||
new OpenCallback(NORMAL, "a1m", "a1d", function (entry) {
|
new OpenCallback(NORMAL, "a1m", "a1d", function () {
|
||||||
finish_cache2_test();
|
finish_cache2_test();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ function run_test() {
|
||||||
"pin",
|
"pin",
|
||||||
Ci.nsICacheStorage.OPEN_TRUNCATE,
|
Ci.nsICacheStorage.OPEN_TRUNCATE,
|
||||||
lci,
|
lci,
|
||||||
new OpenCallback(NEW | WAITFORWRITE, "a1m", "a1d", function (entry) {
|
new OpenCallback(NEW | WAITFORWRITE, "a1m", "a1d", function () {
|
||||||
// Now clear the disk storage, that should leave the pinned entry in the cache
|
// Now clear the disk storage, that should leave the pinned entry in the cache
|
||||||
var diskStorage = getCacheStorage("disk", lci);
|
var diskStorage = getCacheStorage("disk", lci);
|
||||||
diskStorage.asyncEvictStorage(null);
|
diskStorage.asyncEvictStorage(null);
|
||||||
|
|
@ -22,7 +22,7 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
lci,
|
lci,
|
||||||
new OpenCallback(NORMAL, "a1m", "a1d", function (entry) {
|
new OpenCallback(NORMAL, "a1m", "a1d", function () {
|
||||||
// Now clear the pinning storage, entry should be gone
|
// Now clear the pinning storage, entry should be gone
|
||||||
var pinningStorage = getCacheStorage("pin", lci);
|
var pinningStorage = getCacheStorage("pin", lci);
|
||||||
pinningStorage.asyncEvictStorage(null);
|
pinningStorage.asyncEvictStorage(null);
|
||||||
|
|
@ -32,7 +32,7 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
lci,
|
lci,
|
||||||
new OpenCallback(NEW, "", "", function (entry) {
|
new OpenCallback(NEW, "", "", function () {
|
||||||
finish_cache2_test();
|
finish_cache2_test();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -52,13 +52,13 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
lcis[i],
|
lcis[i],
|
||||||
new OpenCallback(NEW, "a1m", "a1d", function (entry) {
|
new OpenCallback(NEW, "a1m", "a1d", function () {
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://a/",
|
"http://a/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
lcis[i],
|
lcis[i],
|
||||||
new OpenCallback(NORMAL, "a1m", "a1d", function (entry) {
|
new OpenCallback(NORMAL, "a1m", "a1d", function () {
|
||||||
mc.fired();
|
mc.fired();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
@ -70,13 +70,13 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
lcis[i],
|
lcis[i],
|
||||||
new OpenCallback(NEW, "b1m", "b1d", function (entry) {
|
new OpenCallback(NEW, "b1m", "b1d", function () {
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
"http://b/",
|
"http://b/",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
lcis[i],
|
lcis[i],
|
||||||
new OpenCallback(NORMAL, "b1m", "b1d", function (entry) {
|
new OpenCallback(NORMAL, "b1m", "b1d", function () {
|
||||||
mc.fired();
|
mc.fired();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -11,25 +11,25 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW, "e1m", "e1d", function (entry) {
|
new OpenCallback(NEW, "e1m", "e1d", function () {
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
URL + "/a",
|
URL + "/a",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NORMAL, "e1m", "e1d", function (entry) {
|
new OpenCallback(NORMAL, "e1m", "e1d", function () {
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
URL2 + "/a",
|
URL2 + "/a",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW, "f1m", "f1d", function (entry) {
|
new OpenCallback(NEW, "f1m", "f1d", function () {
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
URL2 + "/a",
|
URL2 + "/a",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NORMAL, "f1m", "f1d", function (entry) {
|
new OpenCallback(NORMAL, "f1m", "f1d", function () {
|
||||||
var url = Services.io.newURI(URL);
|
var url = Services.io.newURI(URL);
|
||||||
var principal =
|
var principal =
|
||||||
Services.scriptSecurityManager.createContentPrincipal(
|
Services.scriptSecurityManager.createContentPrincipal(
|
||||||
|
|
@ -44,15 +44,13 @@ function run_test() {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NEW, "e1m", "e1d", function (entry) {
|
new OpenCallback(NEW, "e1m", "e1d", function () {
|
||||||
asyncOpenCacheEntry(
|
asyncOpenCacheEntry(
|
||||||
URL2 + "/a",
|
URL2 + "/a",
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_NORMALLY,
|
Ci.nsICacheStorage.OPEN_NORMALLY,
|
||||||
null,
|
null,
|
||||||
new OpenCallback(NORMAL, "f1m", "f1d", function (
|
new OpenCallback(NORMAL, "f1m", "f1d", function () {
|
||||||
entry
|
|
||||||
) {
|
|
||||||
finish_cache2_test();
|
finish_cache2_test();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ add_task(async () => {
|
||||||
contentPolicyType: Ci.nsIContentPolicy.TYPE_DOCUMENT,
|
contentPolicyType: Ci.nsIContentPolicy.TYPE_DOCUMENT,
|
||||||
});
|
});
|
||||||
for (let i = 0; i < CMAX; ++i) {
|
for (let i = 0; i < CMAX; ++i) {
|
||||||
let uri = NetUtil.newURI("http://" + i + ".com/");
|
uri = NetUtil.newURI("http://" + i + ".com/");
|
||||||
Services.cookies.setCookieStringFromHttp(
|
Services.cookies.setCookieStringFromHttp(
|
||||||
uri,
|
uri,
|
||||||
"oh=hai; max-age=1000",
|
"oh=hai; max-age=1000",
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,8 @@ const defaultOriginAttributes = {};
|
||||||
add_task(async function test_none() {
|
add_task(async function test_none() {
|
||||||
let [, inRecord] = await new Promise(resolve => {
|
let [, inRecord] = await new Promise(resolve => {
|
||||||
let listener = {
|
let listener = {
|
||||||
onLookupComplete(inRequest, inRecord, inStatus) {
|
onLookupComplete(inRequest, inRecord1, inStatus) {
|
||||||
resolve([inRequest, inRecord, inStatus]);
|
resolve([inRequest, inRecord1, inStatus]);
|
||||||
},
|
},
|
||||||
QueryInterface: ChromeUtils.generateQI(["nsIDNSListener"]),
|
QueryInterface: ChromeUtils.generateQI(["nsIDNSListener"]),
|
||||||
};
|
};
|
||||||
|
|
@ -45,8 +45,8 @@ add_task(async function test_some() {
|
||||||
gOverride.addIPOverride("example.org", "::1:2:3");
|
gOverride.addIPOverride("example.org", "::1:2:3");
|
||||||
let [, inRecord] = await new Promise(resolve => {
|
let [, inRecord] = await new Promise(resolve => {
|
||||||
let listener = {
|
let listener = {
|
||||||
onLookupComplete(inRequest, inRecord, inStatus) {
|
onLookupComplete(inRequest, inRecord1, inStatus) {
|
||||||
resolve([inRequest, inRecord, inStatus]);
|
resolve([inRequest, inRecord1, inStatus]);
|
||||||
},
|
},
|
||||||
QueryInterface: ChromeUtils.generateQI(["nsIDNSListener"]),
|
QueryInterface: ChromeUtils.generateQI(["nsIDNSListener"]),
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -102,8 +102,8 @@ add_task(
|
||||||
mainThread,
|
mainThread,
|
||||||
defaultOriginAttributes
|
defaultOriginAttributes
|
||||||
);
|
);
|
||||||
let [, , inStatus] = await listener;
|
let [, , inStatus1] = await listener;
|
||||||
Assert.equal(inStatus, Cr.NS_ERROR_UNKNOWN_HOST);
|
Assert.equal(inStatus1, Cr.NS_ERROR_UNKNOWN_HOST);
|
||||||
} else {
|
} else {
|
||||||
Assert.throws(
|
Assert.throws(
|
||||||
() => {
|
() => {
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ function check_doom2(status) {
|
||||||
"disk",
|
"disk",
|
||||||
Ci.nsICacheStorage.OPEN_TRUNCATE,
|
Ci.nsICacheStorage.OPEN_TRUNCATE,
|
||||||
null,
|
null,
|
||||||
function (status, entry) {
|
function (stat, entry) {
|
||||||
write_entry2(entry, entry.openOutputStream(0, -1));
|
write_entry2(entry, entry.openOutputStream(0, -1));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -352,11 +352,11 @@ add_task(async function setup() {
|
||||||
processId = await NodeServer.fork();
|
processId = await NodeServer.fork();
|
||||||
await NodeServer.execute(processId, `serverPort = ${server_port}`);
|
await NodeServer.execute(processId, `serverPort = ${server_port}`);
|
||||||
await NodeServer.execute(processId, http2ProxyCode);
|
await NodeServer.execute(processId, http2ProxyCode);
|
||||||
let proxy = await NodeServer.execute(
|
let newProxy = await NodeServer.execute(
|
||||||
processId,
|
processId,
|
||||||
`http2ProxyCode.startNewProxy()`
|
`http2ProxyCode.startNewProxy()`
|
||||||
);
|
);
|
||||||
proxy_port = proxy.port;
|
proxy_port = newProxy.port;
|
||||||
Assert.notEqual(proxy_port, null);
|
Assert.notEqual(proxy_port, null);
|
||||||
|
|
||||||
Services.prefs.setStringPref(
|
Services.prefs.setStringPref(
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ function resetPrefs() {
|
||||||
prefs.clearUserPref("network.dns.localDomains");
|
prefs.clearUserPref("network.dns.localDomains");
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeChan(origin, path) {
|
function makeChan(path) {
|
||||||
return NetUtil.newChannel({
|
return NetUtil.newChannel({
|
||||||
uri: origin + path,
|
uri: origin + path,
|
||||||
loadUsingSystemPrincipal: true,
|
loadUsingSystemPrincipal: true,
|
||||||
|
|
@ -99,7 +99,7 @@ function doTest1() {
|
||||||
dump("execute doTest1 - resource without immutable. initial request\n");
|
dump("execute doTest1 - resource without immutable. initial request\n");
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
expectConditional = false;
|
expectConditional = false;
|
||||||
var chan = makeChan(origin, "/immutable-test-without-attribute");
|
var chan = makeChan("/immutable-test-without-attribute");
|
||||||
var listener = new Listener();
|
var listener = new Listener();
|
||||||
nextTest = doTest2;
|
nextTest = doTest2;
|
||||||
chan.asyncOpen(listener);
|
chan.asyncOpen(listener);
|
||||||
|
|
@ -109,7 +109,7 @@ function doTest2() {
|
||||||
dump("execute doTest2 - resource without immutable. reload\n");
|
dump("execute doTest2 - resource without immutable. reload\n");
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
expectConditional = true;
|
expectConditional = true;
|
||||||
var chan = makeChan(origin, "/immutable-test-without-attribute");
|
var chan = makeChan("/immutable-test-without-attribute");
|
||||||
var listener = new Listener();
|
var listener = new Listener();
|
||||||
nextTest = doTest3;
|
nextTest = doTest3;
|
||||||
chan.loadFlags = Ci.nsIRequest.VALIDATE_ALWAYS;
|
chan.loadFlags = Ci.nsIRequest.VALIDATE_ALWAYS;
|
||||||
|
|
@ -120,7 +120,7 @@ function doTest3() {
|
||||||
dump("execute doTest3 - resource without immutable. shift reload\n");
|
dump("execute doTest3 - resource without immutable. shift reload\n");
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
expectConditional = false;
|
expectConditional = false;
|
||||||
var chan = makeChan(origin, "/immutable-test-without-attribute");
|
var chan = makeChan("/immutable-test-without-attribute");
|
||||||
var listener = new Listener();
|
var listener = new Listener();
|
||||||
nextTest = doTest4;
|
nextTest = doTest4;
|
||||||
chan.loadFlags = Ci.nsIRequest.LOAD_BYPASS_CACHE;
|
chan.loadFlags = Ci.nsIRequest.LOAD_BYPASS_CACHE;
|
||||||
|
|
@ -131,7 +131,7 @@ function doTest4() {
|
||||||
dump("execute doTest4 - resource with immutable. initial request\n");
|
dump("execute doTest4 - resource with immutable. initial request\n");
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
expectConditional = false;
|
expectConditional = false;
|
||||||
var chan = makeChan(origin, "/immutable-test-with-attribute");
|
var chan = makeChan("/immutable-test-with-attribute");
|
||||||
var listener = new Listener();
|
var listener = new Listener();
|
||||||
nextTest = doTest5;
|
nextTest = doTest5;
|
||||||
chan.asyncOpen(listener);
|
chan.asyncOpen(listener);
|
||||||
|
|
@ -141,7 +141,7 @@ function doTest5() {
|
||||||
dump("execute doTest5 - resource with immutable. reload\n");
|
dump("execute doTest5 - resource with immutable. reload\n");
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
expectConditional = false;
|
expectConditional = false;
|
||||||
var chan = makeChan(origin, "/immutable-test-with-attribute");
|
var chan = makeChan("/immutable-test-with-attribute");
|
||||||
var listener = new Listener();
|
var listener = new Listener();
|
||||||
nextTest = doTest6;
|
nextTest = doTest6;
|
||||||
chan.loadFlags = Ci.nsIRequest.VALIDATE_ALWAYS;
|
chan.loadFlags = Ci.nsIRequest.VALIDATE_ALWAYS;
|
||||||
|
|
@ -152,7 +152,7 @@ function doTest6() {
|
||||||
dump("execute doTest6 - resource with immutable. shift reload\n");
|
dump("execute doTest6 - resource with immutable. shift reload\n");
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
expectConditional = false;
|
expectConditional = false;
|
||||||
var chan = makeChan(origin, "/immutable-test-with-attribute");
|
var chan = makeChan("/immutable-test-with-attribute");
|
||||||
var listener = new Listener();
|
var listener = new Listener();
|
||||||
nextTest = doTest7;
|
nextTest = doTest7;
|
||||||
chan.loadFlags = Ci.nsIRequest.LOAD_BYPASS_CACHE;
|
chan.loadFlags = Ci.nsIRequest.LOAD_BYPASS_CACHE;
|
||||||
|
|
@ -163,7 +163,7 @@ function doTest7() {
|
||||||
dump("execute doTest7 - expired resource with immutable. initial request\n");
|
dump("execute doTest7 - expired resource with immutable. initial request\n");
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
expectConditional = false;
|
expectConditional = false;
|
||||||
var chan = makeChan(origin, "/immutable-test-expired-with-Expires-header");
|
var chan = makeChan("/immutable-test-expired-with-Expires-header");
|
||||||
var listener = new Listener();
|
var listener = new Listener();
|
||||||
nextTest = doTest8;
|
nextTest = doTest8;
|
||||||
chan.asyncOpen(listener);
|
chan.asyncOpen(listener);
|
||||||
|
|
@ -173,7 +173,7 @@ function doTest8() {
|
||||||
dump("execute doTest8 - expired resource with immutable. reload\n");
|
dump("execute doTest8 - expired resource with immutable. reload\n");
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
expectConditional = true;
|
expectConditional = true;
|
||||||
var chan = makeChan(origin, "/immutable-test-expired-with-Expires-header");
|
var chan = makeChan("/immutable-test-expired-with-Expires-header");
|
||||||
var listener = new Listener();
|
var listener = new Listener();
|
||||||
nextTest = doTest9;
|
nextTest = doTest9;
|
||||||
chan.loadFlags = Ci.nsIRequest.VALIDATE_ALWAYS;
|
chan.loadFlags = Ci.nsIRequest.VALIDATE_ALWAYS;
|
||||||
|
|
@ -186,10 +186,7 @@ function doTest9() {
|
||||||
);
|
);
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
expectConditional = false;
|
expectConditional = false;
|
||||||
var chan = makeChan(
|
var chan = makeChan("/immutable-test-expired-with-last-modified-header");
|
||||||
origin,
|
|
||||||
"/immutable-test-expired-with-last-modified-header"
|
|
||||||
);
|
|
||||||
var listener = new Listener();
|
var listener = new Listener();
|
||||||
nextTest = doTest10;
|
nextTest = doTest10;
|
||||||
chan.asyncOpen(listener);
|
chan.asyncOpen(listener);
|
||||||
|
|
@ -201,10 +198,7 @@ function doTest10() {
|
||||||
);
|
);
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
expectConditional = true;
|
expectConditional = true;
|
||||||
var chan = makeChan(
|
var chan = makeChan("/immutable-test-expired-with-last-modified-header");
|
||||||
origin,
|
|
||||||
"/immutable-test-expired-with-last-modified-header"
|
|
||||||
);
|
|
||||||
var listener = new Listener();
|
var listener = new Listener();
|
||||||
nextTest = testsDone;
|
nextTest = testsDone;
|
||||||
chan.loadFlags = Ci.nsIRequest.VALIDATE_ALWAYS;
|
chan.loadFlags = Ci.nsIRequest.VALIDATE_ALWAYS;
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,8 @@ add_task(async function test_empty() {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onStopRequest(request, status) {
|
onStopRequest(request, status1) {
|
||||||
resolve([status, this._buffer]);
|
resolve([status1, this._buffer]);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let conv = streamConv.asyncConvertData(
|
let conv = streamConv.asyncConvertData(
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,10 @@ const { HttpServer } = ChromeUtils.importESModule(
|
||||||
/**
|
/**
|
||||||
* Waits for an observer notification to fire.
|
* Waits for an observer notification to fire.
|
||||||
*
|
*
|
||||||
* @param {String} topic The notification topic.
|
* @param {String} topicName The notification topic.
|
||||||
* @returns {Promise} A promise that fulfills when the notification is fired.
|
* @returns {Promise} A promise that fulfills when the notification is fired.
|
||||||
*/
|
*/
|
||||||
function promiseObserverNotification(topic, matchFunc) {
|
function promiseObserverNotification(topicName, matchFunc) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
Services.obs.addObserver(function observe(subject, topic, data) {
|
Services.obs.addObserver(function observe(subject, topic, data) {
|
||||||
let matches = typeof matchFunc != "function" || matchFunc(subject, data);
|
let matches = typeof matchFunc != "function" || matchFunc(subject, data);
|
||||||
|
|
@ -23,7 +23,7 @@ function promiseObserverNotification(topic, matchFunc) {
|
||||||
}
|
}
|
||||||
Services.obs.removeObserver(observe, topic);
|
Services.obs.removeObserver(observe, topic);
|
||||||
resolve({ subject, data });
|
resolve({ subject, data });
|
||||||
}, topic);
|
}, topicName);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -260,7 +260,7 @@ add_task(async function test_ntlm() {
|
||||||
chan.notificationCallbacks = new Requestor(FLAG_RETURN_FALSE, 2);
|
chan.notificationCallbacks = new Requestor(FLAG_RETURN_FALSE, 2);
|
||||||
let [req, buf] = await new Promise(resolve => {
|
let [req, buf] = await new Promise(resolve => {
|
||||||
chan.asyncOpen(
|
chan.asyncOpen(
|
||||||
new ChannelListener((req, buf) => resolve([req, buf]), null)
|
new ChannelListener((req1, buf1) => resolve([req1, buf1]), null)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
Assert.ok(buf);
|
Assert.ok(buf);
|
||||||
|
|
|
||||||
|
|
@ -492,9 +492,9 @@ function continue_test_origin() {
|
||||||
origin_attributes
|
origin_attributes
|
||||||
);
|
);
|
||||||
do_timeout(0, () => {
|
do_timeout(0, () => {
|
||||||
var origin = extract_origin(sruri);
|
var origin1 = extract_origin(sruri);
|
||||||
if (!preconns.includes(origin)) {
|
if (!preconns.includes(origin1)) {
|
||||||
preconns.push(origin);
|
preconns.push(origin1);
|
||||||
}
|
}
|
||||||
|
|
||||||
sruri = newURI(subresources[2]);
|
sruri = newURI(subresources[2]);
|
||||||
|
|
@ -505,9 +505,9 @@ function continue_test_origin() {
|
||||||
origin_attributes
|
origin_attributes
|
||||||
);
|
);
|
||||||
do_timeout(0, () => {
|
do_timeout(0, () => {
|
||||||
var origin = extract_origin(sruri);
|
var origin2 = extract_origin(sruri);
|
||||||
if (!preconns.includes(origin)) {
|
if (!preconns.includes(origin2)) {
|
||||||
preconns.push(origin);
|
preconns.push(origin2);
|
||||||
}
|
}
|
||||||
|
|
||||||
var loaduri = newURI("http://localhost:4444/anotherpage.html");
|
var loaduri = newURI("http://localhost:4444/anotherpage.html");
|
||||||
|
|
@ -708,9 +708,9 @@ function test_visitor_doom() {
|
||||||
console.debug("asyncDoomURI", aURI.spec);
|
console.debug("asyncDoomURI", aURI.spec);
|
||||||
let doomTask = Promise.all(
|
let doomTask = Promise.all(
|
||||||
storages.map(storage => {
|
storages.map(storage => {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve1 => {
|
||||||
storage.asyncDoomURI(aURI, aIdEnhance, {
|
storage.asyncDoomURI(aURI, aIdEnhance, {
|
||||||
onCacheEntryDoomed: resolve,
|
onCacheEntryDoomed: resolve1,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,8 @@ function checkRequest(request, data, context) {
|
||||||
get_device_entry_count(
|
get_device_entry_count(
|
||||||
"disk",
|
"disk",
|
||||||
Services.loadContextInfo.private,
|
Services.loadContextInfo.private,
|
||||||
function (count) {
|
function (count1) {
|
||||||
Assert.equal(count, 1);
|
Assert.equal(count1, 1);
|
||||||
httpserver.stop(do_test_finished);
|
httpserver.stop(do_test_finished);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ add_task(async function test_slow_upload() {
|
||||||
let { req, buff } = await new Promise(resolve => {
|
let { req, buff } = await new Promise(resolve => {
|
||||||
chan.asyncOpen(
|
chan.asyncOpen(
|
||||||
new ChannelListener(
|
new ChannelListener(
|
||||||
(req, buff) => resolve({ req, buff }),
|
(req1, buff1) => resolve({ req: req1, buff: buff1 }),
|
||||||
null,
|
null,
|
||||||
CL_ALLOW_UNKNOWN_CL
|
CL_ALLOW_UNKNOWN_CL
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,7 @@ function makeChan(url) {
|
||||||
return chan;
|
return chan;
|
||||||
}
|
}
|
||||||
|
|
||||||
function socketAccepted(socket, transport) {
|
function socketAccepted(socket1, transport) {
|
||||||
accepted = true;
|
accepted = true;
|
||||||
|
|
||||||
// copied from httpd.js
|
// copied from httpd.js
|
||||||
|
|
@ -266,7 +266,7 @@ function socketAccepted(socket, transport) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function stopListening(socket, status) {
|
function stopListening() {
|
||||||
if (tests && tests.length !== 0 && do_throw) {
|
if (tests && tests.length !== 0 && do_throw) {
|
||||||
do_throw("should never stop");
|
do_throw("should never stop");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ function makeChan(uri) {
|
||||||
return chan;
|
return chan;
|
||||||
}
|
}
|
||||||
|
|
||||||
function channelOpenPromise(chan, flags, observer) {
|
function channelOpenPromise(chan, flags) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
function finish(req, buffer) {
|
function finish(req, buffer) {
|
||||||
resolve([req, buffer]);
|
resolve([req, buffer]);
|
||||||
|
|
@ -31,6 +31,20 @@ function channelOpenPromise(chan, flags, observer) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function registerSimplePathHandler(server, path) {
|
||||||
|
return server.registerPathHandler(path, (req, resp) => {
|
||||||
|
resp.writeHead(200);
|
||||||
|
resp.end("done");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function regiisterServerNamePathHandler(server, path) {
|
||||||
|
return server.registerPathHandler(path, (req, resp) => {
|
||||||
|
resp.writeHead(200);
|
||||||
|
resp.end(global.server_name);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
add_task(async function test_dual_stack() {
|
add_task(async function test_dual_stack() {
|
||||||
let httpserv = new HttpServer();
|
let httpserv = new HttpServer();
|
||||||
let content = "ok";
|
let content = "ok";
|
||||||
|
|
@ -62,10 +76,7 @@ add_task(async function test_http() {
|
||||||
});
|
});
|
||||||
equal(req.status, Cr.NS_OK);
|
equal(req.status, Cr.NS_OK);
|
||||||
equal(req.QueryInterface(Ci.nsIHttpChannel).responseStatus, 404);
|
equal(req.QueryInterface(Ci.nsIHttpChannel).responseStatus, 404);
|
||||||
await server.registerPathHandler("/test", (req, resp) => {
|
await registerSimplePathHandler(server, "/test");
|
||||||
resp.writeHead(200);
|
|
||||||
resp.end("done");
|
|
||||||
});
|
|
||||||
chan = makeChan(`http://localhost:${server.port()}/test`);
|
chan = makeChan(`http://localhost:${server.port()}/test`);
|
||||||
req = await new Promise(resolve => {
|
req = await new Promise(resolve => {
|
||||||
chan.asyncOpen(new ChannelListener(resolve, null, CL_ALLOW_UNKNOWN_CL));
|
chan.asyncOpen(new ChannelListener(resolve, null, CL_ALLOW_UNKNOWN_CL));
|
||||||
|
|
@ -95,10 +106,7 @@ add_task(async function test_https() {
|
||||||
});
|
});
|
||||||
equal(req.status, Cr.NS_OK);
|
equal(req.status, Cr.NS_OK);
|
||||||
equal(req.QueryInterface(Ci.nsIHttpChannel).responseStatus, 404);
|
equal(req.QueryInterface(Ci.nsIHttpChannel).responseStatus, 404);
|
||||||
await server.registerPathHandler("/test", (req, resp) => {
|
await registerSimplePathHandler(server, "/test");
|
||||||
resp.writeHead(200);
|
|
||||||
resp.end("done");
|
|
||||||
});
|
|
||||||
chan = makeChan(`https://localhost:${server.port()}/test`);
|
chan = makeChan(`https://localhost:${server.port()}/test`);
|
||||||
req = await new Promise(resolve => {
|
req = await new Promise(resolve => {
|
||||||
chan.asyncOpen(new ChannelListener(resolve, null, CL_ALLOW_UNKNOWN_CL));
|
chan.asyncOpen(new ChannelListener(resolve, null, CL_ALLOW_UNKNOWN_CL));
|
||||||
|
|
@ -127,10 +135,7 @@ add_task(async function test_http2() {
|
||||||
});
|
});
|
||||||
equal(req.status, Cr.NS_OK);
|
equal(req.status, Cr.NS_OK);
|
||||||
equal(req.QueryInterface(Ci.nsIHttpChannel).responseStatus, 404);
|
equal(req.QueryInterface(Ci.nsIHttpChannel).responseStatus, 404);
|
||||||
await server.registerPathHandler("/test", (req, resp) => {
|
await registerSimplePathHandler(server, "/test");
|
||||||
resp.writeHead(200);
|
|
||||||
resp.end("done");
|
|
||||||
});
|
|
||||||
chan = makeChan(`https://localhost:${server.port()}/test`);
|
chan = makeChan(`https://localhost:${server.port()}/test`);
|
||||||
req = await new Promise(resolve => {
|
req = await new Promise(resolve => {
|
||||||
chan.asyncOpen(new ChannelListener(resolve, null, CL_ALLOW_UNKNOWN_CL));
|
chan.asyncOpen(new ChannelListener(resolve, null, CL_ALLOW_UNKNOWN_CL));
|
||||||
|
|
@ -167,27 +172,18 @@ add_task(async function test_http1_proxy() {
|
||||||
await server.execute(
|
await server.execute(
|
||||||
`global.server_name = "${server.constructor.name}";`
|
`global.server_name = "${server.constructor.name}";`
|
||||||
);
|
);
|
||||||
await server.registerPathHandler("/test", (req, resp) => {
|
await regiisterServerNamePathHandler(server, "/test");
|
||||||
resp.writeHead(200);
|
let [req1, buff] = await channelOpenPromise(
|
||||||
resp.end(global.server_name);
|
makeChan(`${server.origin()}/test`),
|
||||||
});
|
CL_ALLOW_UNKNOWN_CL
|
||||||
let chan = makeChan(`${server.origin()}/test`);
|
);
|
||||||
let { req, buff } = await new Promise(resolve => {
|
equal(req1.status, Cr.NS_OK);
|
||||||
chan.asyncOpen(
|
equal(req1.QueryInterface(Ci.nsIHttpChannel).responseStatus, 200);
|
||||||
new ChannelListener(
|
|
||||||
(req, buff) => resolve({ req, buff }),
|
|
||||||
null,
|
|
||||||
CL_ALLOW_UNKNOWN_CL
|
|
||||||
)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
equal(req.status, Cr.NS_OK);
|
|
||||||
equal(req.QueryInterface(Ci.nsIHttpChannel).responseStatus, 200);
|
|
||||||
equal(buff, server.constructor.name);
|
equal(buff, server.constructor.name);
|
||||||
//Bug 1792187: Check if proxy is set to true when a proxy is used.
|
//Bug 1792187: Check if proxy is set to true when a proxy is used.
|
||||||
equal(req.QueryInterface(Ci.nsIHttpChannelInternal).isProxyUsed, true);
|
equal(req1.QueryInterface(Ci.nsIHttpChannelInternal).isProxyUsed, true);
|
||||||
equal(
|
equal(
|
||||||
req.QueryInterface(Ci.nsIHttpChannel).protocolVersion,
|
req1.QueryInterface(Ci.nsIHttpChannel).protocolVersion,
|
||||||
server.constructor.name == "NodeHTTP2Server" ? "h2" : "http/1.1"
|
server.constructor.name == "NodeHTTP2Server" ? "h2" : "http/1.1"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -222,22 +218,14 @@ add_task(async function test_https_proxy() {
|
||||||
await server.execute(
|
await server.execute(
|
||||||
`global.server_name = "${server.constructor.name}";`
|
`global.server_name = "${server.constructor.name}";`
|
||||||
);
|
);
|
||||||
await server.registerPathHandler("/test", (req, resp) => {
|
await regiisterServerNamePathHandler(server, "/test");
|
||||||
resp.writeHead(200);
|
|
||||||
resp.end(global.server_name);
|
let [req1, buff] = await channelOpenPromise(
|
||||||
});
|
makeChan(`${server.origin()}/test`),
|
||||||
let chan = makeChan(`${server.origin()}/test`);
|
CL_ALLOW_UNKNOWN_CL
|
||||||
let { req, buff } = await new Promise(resolve => {
|
);
|
||||||
chan.asyncOpen(
|
equal(req1.status, Cr.NS_OK);
|
||||||
new ChannelListener(
|
equal(req1.QueryInterface(Ci.nsIHttpChannel).responseStatus, 200);
|
||||||
(req, buff) => resolve({ req, buff }),
|
|
||||||
null,
|
|
||||||
CL_ALLOW_UNKNOWN_CL
|
|
||||||
)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
equal(req.status, Cr.NS_OK);
|
|
||||||
equal(req.QueryInterface(Ci.nsIHttpChannel).responseStatus, 200);
|
|
||||||
equal(buff, server.constructor.name);
|
equal(buff, server.constructor.name);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
@ -271,22 +259,13 @@ add_task(async function test_http2_proxy() {
|
||||||
await server.execute(
|
await server.execute(
|
||||||
`global.server_name = "${server.constructor.name}";`
|
`global.server_name = "${server.constructor.name}";`
|
||||||
);
|
);
|
||||||
await server.registerPathHandler("/test", (req, resp) => {
|
await regiisterServerNamePathHandler(server, "/test");
|
||||||
resp.writeHead(200);
|
let [req1, buff] = await channelOpenPromise(
|
||||||
resp.end(global.server_name);
|
makeChan(`${server.origin()}/test`),
|
||||||
});
|
CL_ALLOW_UNKNOWN_CL
|
||||||
let chan = makeChan(`${server.origin()}/test`);
|
);
|
||||||
let { req, buff } = await new Promise(resolve => {
|
equal(req1.status, Cr.NS_OK);
|
||||||
chan.asyncOpen(
|
equal(req1.QueryInterface(Ci.nsIHttpChannel).responseStatus, 200);
|
||||||
new ChannelListener(
|
|
||||||
(req, buff) => resolve({ req, buff }),
|
|
||||||
null,
|
|
||||||
CL_ALLOW_UNKNOWN_CL
|
|
||||||
)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
equal(req.status, Cr.NS_OK);
|
|
||||||
equal(req.QueryInterface(Ci.nsIHttpChannel).responseStatus, 200);
|
|
||||||
equal(buff, server.constructor.name);
|
equal(buff, server.constructor.name);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
@ -331,15 +310,7 @@ add_task(async function test_proxy_with_redirects() {
|
||||||
});
|
});
|
||||||
|
|
||||||
let chan = makeChan(`${server.origin()}/redirect`);
|
let chan = makeChan(`${server.origin()}/redirect`);
|
||||||
let { req, buff } = await new Promise(resolve => {
|
let [req, buff] = await channelOpenPromise(chan, CL_ALLOW_UNKNOWN_CL);
|
||||||
chan.asyncOpen(
|
|
||||||
new ChannelListener(
|
|
||||||
(req, buff) => resolve({ req, buff }),
|
|
||||||
null,
|
|
||||||
CL_ALLOW_UNKNOWN_CL
|
|
||||||
)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
equal(req.status, Cr.NS_OK);
|
equal(req.status, Cr.NS_OK);
|
||||||
equal(req.QueryInterface(Ci.nsIHttpChannel).responseStatus, 200);
|
equal(req.QueryInterface(Ci.nsIHttpChannel).responseStatus, 200);
|
||||||
equal(buff, server.constructor.name);
|
equal(buff, server.constructor.name);
|
||||||
|
|
|
||||||
|
|
@ -52,12 +52,12 @@ function getTempFile(leafName) {
|
||||||
function promiseSaverComplete(aSaver, aOnTargetChangeFn) {
|
function promiseSaverComplete(aSaver, aOnTargetChangeFn) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
aSaver.observer = {
|
aSaver.observer = {
|
||||||
onTargetChange: function BFSO_onSaveComplete(aSaver, aTarget) {
|
onTargetChange: function BFSO_onSaveComplete(saver, aTarget) {
|
||||||
if (aOnTargetChangeFn) {
|
if (aOnTargetChangeFn) {
|
||||||
aOnTargetChangeFn(aTarget);
|
aOnTargetChangeFn(aTarget);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onSaveComplete: function BFSO_onSaveComplete(aSaver, aStatus) {
|
onSaveComplete: function BFSO_onSaveComplete(saver, aStatus) {
|
||||||
if (Components.isSuccessCode(aStatus)) {
|
if (Components.isSuccessCode(aStatus)) {
|
||||||
resolve();
|
resolve();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -91,8 +91,8 @@ function startServer(
|
||||||
|
|
||||||
input.asyncWait(
|
input.asyncWait(
|
||||||
{
|
{
|
||||||
onInputStreamReady(input) {
|
onInputStreamReady(input1) {
|
||||||
NetUtil.asyncCopy(input, output);
|
NetUtil.asyncCopy(input1, output);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
0,
|
0,
|
||||||
|
|
@ -144,17 +144,17 @@ function startClient(port, sendClientCert, expectingAlert, tlsVersion) {
|
||||||
let outputDeferred = PromiseUtils.defer();
|
let outputDeferred = PromiseUtils.defer();
|
||||||
|
|
||||||
let handler = {
|
let handler = {
|
||||||
onTransportStatus(transport, status) {
|
onTransportStatus(transport1, status) {
|
||||||
if (status === Ci.nsISocketTransport.STATUS_CONNECTED_TO) {
|
if (status === Ci.nsISocketTransport.STATUS_CONNECTED_TO) {
|
||||||
output.asyncWait(handler, 0, 0, Services.tm.currentThread);
|
output.asyncWait(handler, 0, 0, Services.tm.currentThread);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onInputStreamReady(input) {
|
onInputStreamReady(input1) {
|
||||||
try {
|
try {
|
||||||
let data = NetUtil.readInputStreamToString(input, input.available());
|
let data = NetUtil.readInputStreamToString(input1, input1.available());
|
||||||
equal(data, "HELLO", "Echoed data received");
|
equal(data, "HELLO", "Echoed data received");
|
||||||
input.close();
|
input1.close();
|
||||||
output.close();
|
output.close();
|
||||||
ok(!expectingAlert, "No cert alert expected");
|
ok(!expectingAlert, "No cert alert expected");
|
||||||
inputDeferred.resolve();
|
inputDeferred.resolve();
|
||||||
|
|
@ -166,7 +166,7 @@ function startClient(port, sendClientCert, expectingAlert, tlsVersion) {
|
||||||
errorCode == SSL_ERROR_BAD_CERT_ALERT
|
errorCode == SSL_ERROR_BAD_CERT_ALERT
|
||||||
) {
|
) {
|
||||||
info("Got bad cert alert as expected for tls 1.2");
|
info("Got bad cert alert as expected for tls 1.2");
|
||||||
input.close();
|
input1.close();
|
||||||
output.close();
|
output.close();
|
||||||
inputDeferred.resolve();
|
inputDeferred.resolve();
|
||||||
return;
|
return;
|
||||||
|
|
@ -176,7 +176,7 @@ function startClient(port, sendClientCert, expectingAlert, tlsVersion) {
|
||||||
errorCode == SSL_ERROR_RX_CERTIFICATE_REQUIRED_ALERT
|
errorCode == SSL_ERROR_RX_CERTIFICATE_REQUIRED_ALERT
|
||||||
) {
|
) {
|
||||||
info("Got cert required alert as expected for tls 1.3");
|
info("Got cert required alert as expected for tls 1.3");
|
||||||
input.close();
|
input1.close();
|
||||||
output.close();
|
output.close();
|
||||||
inputDeferred.resolve();
|
inputDeferred.resolve();
|
||||||
return;
|
return;
|
||||||
|
|
@ -186,9 +186,9 @@ function startClient(port, sendClientCert, expectingAlert, tlsVersion) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onOutputStreamReady(output) {
|
onOutputStreamReady(output1) {
|
||||||
try {
|
try {
|
||||||
output.write("HELLO", 5);
|
output1.write("HELLO", 5);
|
||||||
info("Output to server written");
|
info("Output to server written");
|
||||||
outputDeferred.resolve();
|
outputDeferred.resolve();
|
||||||
input = transport.openInputStream(0, 0, 0);
|
input = transport.openInputStream(0, 0, 0);
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,8 @@ function startServer(cert) {
|
||||||
|
|
||||||
input.asyncWait(
|
input.asyncWait(
|
||||||
{
|
{
|
||||||
onInputStreamReady(input) {
|
onInputStreamReady(input1) {
|
||||||
NetUtil.asyncCopy(input, output);
|
NetUtil.asyncCopy(input1, output);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
0,
|
0,
|
||||||
|
|
@ -86,17 +86,17 @@ function startClient(port) {
|
||||||
let outputDeferred = PromiseUtils.defer();
|
let outputDeferred = PromiseUtils.defer();
|
||||||
|
|
||||||
let handler = {
|
let handler = {
|
||||||
onTransportStatus(transport, status) {
|
onTransportStatus(transport1, status) {
|
||||||
if (status === Ci.nsISocketTransport.STATUS_CONNECTED_TO) {
|
if (status === Ci.nsISocketTransport.STATUS_CONNECTED_TO) {
|
||||||
output.asyncWait(handler, 0, 0, Services.tm.currentThread);
|
output.asyncWait(handler, 0, 0, Services.tm.currentThread);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onInputStreamReady(input) {
|
onInputStreamReady(input1) {
|
||||||
try {
|
try {
|
||||||
let data = NetUtil.readInputStreamToString(input, input.available());
|
let data = NetUtil.readInputStreamToString(input1, input1.available());
|
||||||
equal(data, "HELLO", "Echoed data received");
|
equal(data, "HELLO", "Echoed data received");
|
||||||
input.close();
|
input1.close();
|
||||||
output.close();
|
output.close();
|
||||||
inputDeferred.resolve();
|
inputDeferred.resolve();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
@ -104,9 +104,9 @@ function startClient(port) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onOutputStreamReady(output) {
|
onOutputStreamReady(output1) {
|
||||||
try {
|
try {
|
||||||
output.write("HELLO", 5);
|
output1.write("HELLO", 5);
|
||||||
info("Output to server written");
|
info("Output to server written");
|
||||||
outputDeferred.resolve();
|
outputDeferred.resolve();
|
||||||
input = transport.openInputStream(0, 0, 0);
|
input = transport.openInputStream(0, 0, 0);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue