Bug 1864896: Autofix unused function arguments (netwerk). r=kershaw,cookie-reviewers,valentin

Differential Revision: https://phabricator.services.mozilla.com/D202975
This commit is contained in:
Dave Townsend 2024-03-01 20:52:28 +00:00
Родитель a7685d99a9
Коммит d87184a011
250 изменённых файлов: 573 добавлений и 617 удалений

Просмотреть файл

@ -66,7 +66,7 @@ export var NetUtil = {
var observer;
if (aCallback) {
observer = {
onStartRequest(aRequest) {},
onStartRequest() {},
onStopRequest(aRequest, aStatusCode) {
aCallback(aStatusCode);
},
@ -118,7 +118,7 @@ export var NetUtil = {
"@mozilla.org/network/simple-stream-listener;1"
].createInstance(Ci.nsISimpleStreamListener);
listener.init(pipe.outputStream, {
onStartRequest(aRequest) {},
onStartRequest() {},
onStopRequest(aRequest, aStatusCode) {
pipe.outputStream.close();
aCallback(pipe.inputStream, aStatusCode, aRequest);

Просмотреть файл

@ -29,7 +29,7 @@ add_setup(async function () {
function waitForNotificationPromise(notification, expected) {
return new Promise(resolve => {
function observer(subject, topic, data) {
function observer() {
is(content.document.cookie, expected);
Services.obs.removeObserver(observer, notification);
resolve();
@ -70,7 +70,7 @@ add_task(async function test_purge_sync_batch_and_deleted() {
() => content.document.cookie == "",
"cookie did not expire in time",
200
).catch(msg => {
).catch(() => {
is(false, "Cookie did not expire in time");
});
});

Просмотреть файл

@ -42,7 +42,7 @@ CookiePolicyHelper.runTest("IndexedDB in workers", {
}
};
worker.onerror = function (e) {
worker.onerror = function () {
reject();
};
});
@ -76,7 +76,7 @@ CookiePolicyHelper.runTest("IndexedDB in workers", {
}
};
worker.onerror = function (e) {
worker.onerror = function () {
reject();
};
});

Просмотреть файл

@ -88,7 +88,7 @@ add_task(async _ => {
let test = tests[i];
let promise = new Promise(resolve => {
function observer(subject, topic, data) {
function observer() {
Services.obs.removeObserver(observer, "cookie-saved-on-disk");
resolve();
}

Просмотреть файл

@ -71,7 +71,7 @@ const downloadToDiskBackup = CLIENT.attachments.downloadToDisk;
// returns a fake fileURI and sends a signal with filePath and no nsifile
function mockDownloadToDisk() {
downloadToDiskCalled = false;
CLIENT.attachments.downloadToDisk = async rec => {
CLIENT.attachments.downloadToDisk = async () => {
downloadToDiskCalled = true;
return `file://${mockedFilePath}`; // Create a fake file URI
};

Просмотреть файл

@ -41,7 +41,7 @@ async function test_hint_asset(testName, asset, variant) {
let observer = {
QueryInterface: ChromeUtils.generateQI(["nsIObserver"]),
observe(aSubject, aTopic, aData) {
observe(aSubject, aTopic) {
if (aTopic == "earlyhints-connectback") {
numConnectBackRemaining -= 1;
}

Просмотреть файл

@ -16,7 +16,7 @@ add_task(async function test_103_cancel_parent_connect() {
let observed_cancel_reason = "";
let observer = {
QueryInterface: ChromeUtils.generateQI(["nsIObserver"]),
observe(aSubject, aTopic, aData) {
observe(aSubject, aTopic) {
aSubject = aSubject.QueryInterface(Ci.nsIRequest);
if (
aTopic == "http-on-stop-request" &&

Просмотреть файл

@ -35,7 +35,7 @@ async function test_early_hints_load_url(usePrivateWin) {
let observed = {};
let observer = {
QueryInterface: ChromeUtils.generateQI(["nsIObserver"]),
observe(aSubject, aTopic, aData) {
observe(aSubject, aTopic) {
if (aTopic == "http-on-opening-request") {
let channel = aSubject.QueryInterface(Ci.nsIHttpChannel);
if (channel.URI.spec === expectedUrl) {

Просмотреть файл

@ -111,7 +111,7 @@ async function test_hint_redirect(
if (numRequestRemaining > 0) {
let observer = {
QueryInterface: ChromeUtils.generateQI(["nsIObserver"]),
observe(aSubject, aTopic, aData) {
observe(aSubject, aTopic) {
aSubject.QueryInterface(Ci.nsIIdentChannel);
let id = aSubject.channelId;
if (observedChannelIds.includes(id)) {

Просмотреть файл

@ -107,5 +107,5 @@ WindowListener.prototype = {
{ once: true }
);
},
onCloseWindow(aXULWindow) {},
onCloseWindow() {},
};

Просмотреть файл

@ -26,7 +26,7 @@ CustomProtocolHandler.prototype = {
newChannel(aURI, aLoadInfo) {
return new CustomChannel(aURI, aLoadInfo);
},
allowPort(port, scheme) {
allowPort(port) {
return port != -1;
},
@ -56,7 +56,7 @@ CustomChannel.prototype = {
set uploadStream(val) {
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
setUploadStream(aStream, aContentType, aContentLength) {
setUploadStream(aStream) {
this._uploadStream = aStream;
},
@ -172,7 +172,7 @@ document.getElementById('form').submit();
get status() {
return Cr.NS_OK;
},
cancel(status) {},
cancel() {},
loadGroup: null,
loadFlags:
Ci.nsIRequest.LOAD_NORMAL |

Просмотреть файл

@ -35,8 +35,8 @@ add_task(async function testRequestIOActivity() {
waitForExplicitFinish();
Services.obs.notifyObservers(null, "profile-initial-state");
await BrowserTestUtils.withNewTab(TEST_URL, async function (browser) {
await BrowserTestUtils.withNewTab(TEST_URL2, async function (browser) {
await BrowserTestUtils.withNewTab(TEST_URL, async function () {
await BrowserTestUtils.withNewTab(TEST_URL2, async function () {
let results = await ChromeUtils.requestIOActivity();
processResults(results);

Просмотреть файл

@ -450,7 +450,7 @@ nsHttpServer.prototype = {
* was stopped using nsIHttpServer.stop)
* @see nsIServerSocketListener.onStopListening
*/
onStopListening(socket, status) {
onStopListening(socket) {
dumpn(">>> shutting down server on port " + socket.port);
for (var n in this._connections) {
if (!this._connections[n]._requestStarted) {
@ -4430,7 +4430,7 @@ Response.prototype = {
var response = this;
var copyObserver = {
onStartRequest(request) {
onStartRequest() {
dumpn("*** preamble copying started");
},
@ -4488,7 +4488,7 @@ Response.prototype = {
var response = this;
var copyObserver = {
onStartRequest(request) {
onStartRequest() {
dumpn("*** onStartRequest");
},

Просмотреть файл

@ -1 +1 @@
function handleRequest(request, response) {}
function handleRequest() {}

Просмотреть файл

@ -22,7 +22,7 @@ function run_test() {
const REQUEST_DATA = "12345678901234567";
function contentLength(request, response) {
function contentLength(request) {
Assert.equal(request.method, "POST");
Assert.equal(request.getHeader("Content-Length"), "017");

Просмотреть файл

@ -78,18 +78,18 @@ function start_multiple_exceptions_500(ch) {
checkStatusLine(ch, 1, 1, 500, "Internal Server Error");
}
function succeeded(ch, status, data) {
function succeeded(ch, status) {
Assert.ok(Components.isSuccessCode(status));
}
function register400Handler(ch) {
function register400Handler() {
srv.registerErrorHandler(400, throwsException);
}
// PATH HANDLERS
// /throws/exception (and also a 404 and 400 error handler)
function throwsException(metadata, response) {
function throwsException() {
throw new Error("this shouldn't cause an exit...");
do_throw("Not reached!"); // eslint-disable-line no-unreachable
}

Просмотреть файл

@ -181,7 +181,7 @@ handlers["/handleAsync2"] = handleAsync2;
var startTime_handleAsync2;
function init_handleAsync2(ch) {
function init_handleAsync2() {
var now = (startTime_handleAsync2 = Date.now());
dumpn("*** init_HandleAsync2: start time " + now);
}

Просмотреть файл

@ -44,7 +44,7 @@ function stopCustomIndexHandler(ch, status, data) {
function startDefaultIndexHandler(ch) {
Assert.equal(ch.responseStatus, 200);
}
function stopDefaultIndexHandler(ch, status, data) {
function stopDefaultIndexHandler(ch, status) {
Assert.ok(Components.isSuccessCode(status));
}

Просмотреть файл

@ -69,11 +69,11 @@ ChromeUtils.defineLazyGetter(this, "tests", function () {
});
// /no/setstatusline
function noSetstatusline(metadata, response) {}
function noSetstatusline() {}
function startNoSetStatusLine(ch) {
checkStatusLine(ch, 1, 1, 200, "OK");
}
function stop(ch, status, data) {
function stop(ch, status) {
Assert.ok(Components.isSuccessCode(status));
}

Просмотреть файл

@ -210,7 +210,7 @@ tests.push(test);
// extension of the file on the server, not by the extension of the requested
// path.
function setupFileMapping(ch) {
function setupFileMapping() {
srv.registerFile("/script.html", sjs);
}

Просмотреть файл

@ -56,7 +56,7 @@ function run_test() {
*/
var initialStarted = false;
function initialStart(ch) {
function initialStart() {
dumpn("*** initialStart");
if (initialStarted) {
@ -106,7 +106,7 @@ function initialStop(ch, status, data) {
}
var intermediateStarted = false;
function intermediateStart(ch) {
function intermediateStart() {
dumpn("*** intermediateStart");
Assert.notEqual(srv.getObjectState("object-state-test"), null);
@ -152,7 +152,7 @@ function intermediateStop(ch, status, data) {
}
var triggerStarted = false;
function triggerStart(ch) {
function triggerStart() {
dumpn("*** triggerStart");
if (!initialStarted) {

Просмотреть файл

@ -13,12 +13,12 @@ var observer = {
},
};
addMessageListener("createObserver", function (e) {
addMessageListener("createObserver", function () {
Services.obs.addObserver(observer, "cookie-changed");
sendAsyncMessage("createObserver:return");
});
addMessageListener("removeObserver", function (e) {
addMessageListener("removeObserver", function () {
Services.obs.removeObserver(observer, "cookie-changed");
sendAsyncMessage("removeObserver:return");
});

Просмотреть файл

@ -13,7 +13,7 @@ SimpleTest.waitForExplicitFinish();
var script = SpecialPowers.loadChromeScript(() => {
/* eslint-env mozilla/chrome-script */
Services.obs.addObserver(function onExamResp(subject, topic, data) {
Services.obs.addObserver(function onExamResp(subject) {
let channel = subject.QueryInterface(Ci.nsIHttpChannel);
if (!channel.URI.spec.startsWith("http://example.org")) {
return;

Просмотреть файл

@ -24,7 +24,7 @@ iframe.addEventListener("load", finishTest);
document.body.appendChild(iframe);
iframe.src = "http://mochi.test:8888/tests/netwerk/test/mochitests/redirect_idn.html";
function finishTest(e) {
function finishTest() {
ok(true);
SimpleTest.finish();
}

Просмотреть файл

@ -193,7 +193,7 @@ function frameLoaded(test, check)
function submitForm(test, check)
{
return new Promise((resolve, reject) => {
return new Promise((resolve) => {
document.getElementById(check.frameID).onload = () => {
frameLoaded(test, check);
resolve();
@ -204,7 +204,7 @@ function submitForm(test, check)
function loadIframe(test, check)
{
return new Promise((resolve, reject) => {
return new Promise((resolve) => {
let frame = SpecialPowers.wrap(window.document.getElementById(check.frameID));
frame.onload = function () {
// Ignore the first load and wait for the submitted form instead.
@ -220,7 +220,7 @@ function loadIframe(test, check)
function loadSrcDocFrame(test, check)
{
return new Promise((resolve, reject) => {
return new Promise((resolve) => {
let frame = SpecialPowers.wrap(window.document.getElementById(check.frameID));
frame.onload = function () {
// Ignore the first load and wait for the submitted form instead.
@ -240,7 +240,7 @@ function loadSrcDocFrame(test, check)
function loadDataURIFrame(test, check)
{
return new Promise((resolve, reject) => {
return new Promise((resolve) => {
let frame = SpecialPowers.wrap(window.document.getElementById(check.frameID));
frame.onload = function () {
// Ignore the first load and wait for the submitted form instead.
@ -262,7 +262,7 @@ async function resetFrames()
{
let checkPromises = [];
for (let check of checksToRun) {
checkPromises.push(new Promise((resolve, reject) => {
checkPromises.push(new Promise((resolve) => {
let frame = document.getElementById(check.frameID);
frame.onload = () => resolve();
if (check.srcdoc) {

Просмотреть файл

@ -26,7 +26,7 @@
/* Check that the iframe has initial content only after the first load.
*/
function expectInitialContent(e) {
function expectInitialContent() {
info("expectInitialContent",
"First response received: should have partial content");
var frameElement = document.getElementById('contentFrame');
@ -57,7 +57,7 @@ function expectInitialContent(e) {
/* Check that the iframe has all the content after the second load.
*/
function expectFullContent(e)
function expectFullContent()
{
info("expectFullContent",
"Second response received: should complete content from first load");

Просмотреть файл

@ -18,7 +18,7 @@ iframe.addEventListener("load", finishTest);
document.body.appendChild(iframe);
iframe.src = "redirect.sjs#start";
function finishTest(e) {
function finishTest() {
is(iframe.contentWindow.location.href, "http://mochi.test:8888/tests/netwerk/test/mochitests/empty.html#");
SimpleTest.finish();
}

Просмотреть файл

@ -19,7 +19,7 @@ async function doTest()
{
await SpecialPowers.setBoolPref("network.http.debug-observations", true);
observer = SpecialPowers.wrapCallback(function(subject, topic, data) {
observer = SpecialPowers.wrapCallback(function() {
remainder--;
ok(true, "observed remainder = " + remainder);
if (!remainder) {

Просмотреть файл

@ -84,7 +84,7 @@ function syncWithCacheIOThread(callback, force) {
"disk",
Ci.nsICacheStorage.OPEN_READONLY,
null,
function (status, entry) {
function (status) {
Assert.equal(status, Cr.NS_ERROR_CACHE_KEY_NOT_FOUND);
callback();
}

Просмотреть файл

@ -71,8 +71,8 @@ function pumpReadStream(inputStream, goon) {
pump.init(inputStream, 0, 0, true);
let data = "";
pump.asyncRead({
onStartRequest(aRequest) {},
onDataAvailable(aRequest, aInputStream, aOffset, aCount) {
onStartRequest() {},
onDataAvailable(aRequest, aInputStream) {
var wrapper = Cc["@mozilla.org/scriptableinputstream;1"].createInstance(
Ci.nsIScriptableInputStream
);
@ -422,7 +422,7 @@ function wait_for_cache_index(continue_func) {
}
function finish_cache2_test() {
callbacks.forEach(function (callback, index) {
callbacks.forEach(function (callback) {
callback.selfCheck();
});
do_test_finished();

Просмотреть файл

@ -537,13 +537,13 @@ class SimpleChannelListener {
return ChromeUtils.generateQI(["nsIStreamListener", "nsIRequestObserver"]);
}
onStartRequest(request) {}
onStartRequest() {}
onDataAvailable(request, stream, offset, count) {
this._buffer = this._buffer.concat(read_stream(stream, count));
}
onStopRequest(request, status) {
onStopRequest(request) {
if (this._onStopCallback) {
this._onStopCallback(request, this._buffer);
}

Просмотреть файл

@ -59,7 +59,7 @@ function _observer(generator, topic) {
}
_observer.prototype = {
observe(subject, topic, data) {
observe(subject, topic) {
Assert.equal(this.topic, topic);
Services.obs.removeObserver(this, this.topic);
@ -93,7 +93,7 @@ function _promise_observer(topic) {
}
_promise_observer.prototype = {
observe(subject, topic, data) {
observe(subject, topic) {
Assert.equal(this.topic, topic);
Services.obs.removeObserver(this, this.topic);

Просмотреть файл

@ -44,13 +44,13 @@ CheckHttp3Listener.prototype = {
expectedRoute: "",
http3version: "",
onStartRequest: function testOnStartRequest(request) {},
onStartRequest: function testOnStartRequest() {},
onDataAvailable: function testOnDataAvailable(request, stream, off, cnt) {
read_stream(stream, cnt);
},
onStopRequest: function testOnStopRequest(request, status) {
onStopRequest: function testOnStopRequest(request) {
let routed = "NA";
try {
routed = request.getRequestHeader("Alt-Used");

Просмотреть файл

@ -858,22 +858,22 @@ class WebSocketConnection {
]);
}
onAcknowledge(aContext, aSize) {}
onAcknowledge() {}
onBinaryMessageAvailable(aContext, aMsg) {
this._messages.push(aMsg);
this._msgCallback();
}
onMessageAvailable(aContext, aMsg) {}
onServerClose(aContext, aCode, aReason) {}
onWebSocketListenerStart(aContext) {}
onStart(aContext) {
onMessageAvailable() {}
onServerClose() {}
onWebSocketListenerStart() {}
onStart() {
this._openCallback();
}
onStop(aContext, aStatusCode) {
this._stopCallback({ status: aStatusCode });
this._ws = null;
}
onProxyAvailable(req, chan, proxyInfo, status) {
onProxyAvailable(req, chan, proxyInfo) {
if (proxyInfo) {
this._proxyAvailCallback({ type: proxyInfo.type });
} else {

Просмотреть файл

@ -263,7 +263,7 @@ function answerHandler(req, resp) {
answers: response.answers || [],
additionals: response.additionals || [],
});
let writeResponse = (resp2, buf2, context) => {
let writeResponse = (resp2, buf2) => {
try {
let data = buf2.toString("hex");
resp2.setHeader("Content-Length", data.length);

Просмотреть файл

@ -17,16 +17,16 @@ WebSocketListener.prototype = {
_received: null,
QueryInterface: ChromeUtils.generateQI(["nsIWebSocketListener"]),
onAcknowledge(aContext, aSize) {},
onAcknowledge() {},
onBinaryMessageAvailable(aContext, aMsg) {
info("WsListener::onBinaryMessageAvailable");
this._received = aMsg;
this._ws.close(0, null);
},
onMessageAvailable(aContext, aMsg) {},
onServerClose(aContext, aCode, aReason) {},
onWebSocketListenerStart(aContext) {},
onStart(aContext) {
onMessageAvailable() {},
onServerClose() {},
onWebSocketListenerStart() {},
onStart() {
this._ws.sendMsg(this._sentMsg);
},
onStop(aContext, aStatusCode) {

Просмотреть файл

@ -123,7 +123,7 @@ Http2MultiplexListener.prototype.onDataAvailable = function (
this.buffer = this.buffer.concat(data);
};
Http2MultiplexListener.prototype.onStopRequest = function (request, status) {
Http2MultiplexListener.prototype.onStopRequest = function (request) {
Assert.ok(this.onStartRequestFired);
Assert.ok(this.onDataAvailableFired);
Assert.ok(this.isHttp2Connection);
@ -290,7 +290,7 @@ Http2BigListener.prototype.onDataAvailable = function (
Assert.equal(bigListenerMD5, request.getResponseHeader("X-Expected-MD5"));
};
Http2BigListener.prototype.onStopRequest = function (request, status) {
Http2BigListener.prototype.onStopRequest = function (request) {
Assert.ok(this.onStartRequestFired);
Assert.ok(this.onDataAvailableFired);
Assert.ok(this.isHttp2Connection);
@ -320,10 +320,7 @@ Http2HugeSuspendedListener.prototype.onDataAvailable = function (
read_stream(stream, cnt);
};
Http2HugeSuspendedListener.prototype.onStopRequest = function (
request,
status
) {
Http2HugeSuspendedListener.prototype.onStopRequest = function (request) {
Assert.ok(this.onStartRequestFired);
Assert.ok(this.onDataAvailableFired);
Assert.ok(this.isHttp2Connection);
@ -470,7 +467,7 @@ async function test_http2_xhr(serverPort) {
return new Promise(resolve => {
var req = new XMLHttpRequest();
req.open("GET", `https://localhost:${serverPort}/`, true);
req.addEventListener("readystatechange", function (evt) {
req.addEventListener("readystatechange", function () {
checkXhr(req, resolve);
});
req.send(null);
@ -485,7 +482,7 @@ Http2ConcurrentListener.prototype.target = 0;
Http2ConcurrentListener.prototype.reset = 0;
Http2ConcurrentListener.prototype.recvdHdr = 0;
Http2ConcurrentListener.prototype.onStopRequest = function (request, status) {
Http2ConcurrentListener.prototype.onStopRequest = function (request) {
this.count++;
Assert.ok(this.isHttp2Connection);
if (this.recvdHdr > 0) {
@ -814,7 +811,7 @@ altsvcClientListener.prototype = {
read_stream(stream, cnt);
},
onStopRequest: function test_onStopR(request, status) {
onStopRequest: function test_onStopR(request) {
var isHttp2Connection = checkIsHttp2(
request.QueryInterface(Ci.nsIHttpChannel)
);
@ -875,7 +872,7 @@ altsvcClientListener2.prototype = {
read_stream(stream, cnt);
},
onStopRequest: function test_onStopR(request, status) {
onStopRequest: function test_onStopR(request) {
var isHttp2Connection = checkIsHttp2(
request.QueryInterface(Ci.nsIHttpChannel)
);
@ -959,7 +956,7 @@ Http2PushApiListener.prototype = {
},
// normal Channel listeners
onStartRequest: function pushAPIOnStart(request) {},
onStartRequest: function pushAPIOnStart() {},
onDataAvailable: function pushAPIOnDataAvailable(
request,
@ -997,7 +994,7 @@ Http2PushApiListener.prototype = {
}
},
onStopRequest: function test_onStopR(request, status) {
onStopRequest: function test_onStopR(request) {
if (
request.originalURI.spec ==
`https://localhost:${this.serverPort}/pushapi1/2`
@ -1100,10 +1097,7 @@ function H11RequiredSessionListener() {}
H11RequiredSessionListener.prototype = new Http2CheckListener();
H11RequiredSessionListener.prototype.onStopRequest = function (
request,
status
) {
H11RequiredSessionListener.prototype.onStopRequest = function (request) {
var streamReused = request.getResponseHeader("X-H11Required-Stream-Ok");
Assert.equal(streamReused, "yes");
@ -1157,8 +1151,7 @@ Http2IllegalHpackValidationListener.prototype = new Http2CheckListener();
Http2IllegalHpackValidationListener.prototype.shouldGoAway = false;
Http2IllegalHpackValidationListener.prototype.onStopRequest = function (
request,
status
request
) {
var wentAway = request.getResponseHeader("X-Did-Goaway") === "yes";
Assert.equal(wentAway, this.shouldGoAway);
@ -1176,7 +1169,7 @@ function Http2IllegalHpackListener() {}
Http2IllegalHpackListener.prototype = new Http2CheckListener();
Http2IllegalHpackListener.prototype.shouldGoAway = false;
Http2IllegalHpackListener.prototype.onStopRequest = function (request, status) {
Http2IllegalHpackListener.prototype.onStopRequest = function () {
var chan = makeHTTPChannel(
`https://localhost:${this.serverPort}/illegalhpack_validate`
);

Просмотреть файл

@ -16,7 +16,7 @@ add_task(async function killOnEnd() {
await NodeServer.execute(id, `console.log("hello");`);
await NodeServer.execute(id, `console.error("hello");`);
// Make the forked subprocess hang forever.
NodeServer.execute(id, "while (true) {}").catch(e => {});
NodeServer.execute(id, "while (true) {}").catch(() => {});
await new Promise(resolve => do_timeout(10, resolve));
// Should get killed at the end of the test by the harness.
});

Просмотреть файл

@ -66,7 +66,7 @@ add_task(async function test() {
);
resolve();
},
onStartRequest(req) {},
onStartRequest() {},
onDataAvailable() {},
});
});
@ -84,7 +84,7 @@ add_task(async function test() {
);
resolve();
},
onStartRequest(req) {},
onStartRequest() {},
onDataAvailable() {},
});
});

Просмотреть файл

@ -48,7 +48,7 @@ function run_test() {
run_next_test();
}
function consume304(request, buffer) {
function consume304(request) {
request.QueryInterface(Ci.nsIHttpChannel);
Assert.equal(request.responseStatus, 304);
Assert.equal(request.getResponseHeader("Returned-From-Handler"), "1");

Просмотреть файл

@ -52,7 +52,7 @@ function serverHandler(metadata, response) {
response.bodyOutputStream.write(httpbody, httpbody.length);
}
function checkRequestResponse(request, data, context) {
function checkRequestResponse(request, data) {
Assert.equal(channel.responseStatus, 200);
Assert.equal(channel.responseStatusText, "OK");
Assert.ok(channel.requestSucceeded);

Просмотреть файл

@ -95,7 +95,7 @@ function firstTimeThrough(request, buffer) {
Assert.ok(gMockPromptService.firstTimeCalled, "Prompt service invoked");
}
function secondTimeThrough(request, buffer) {
function secondTimeThrough(request) {
Assert.equal(request.status, Cr.NS_ERROR_SUPERFLUOS_AUTH);
httpServer.stop(do_test_finished);
}

Просмотреть файл

@ -618,7 +618,7 @@ function do_test_uri_with_hash_suffix(aTest, aSuffix) {
do_check_property(aTest, testURI, "pathQueryRef", function (aStr) {
return aStr + aSuffix;
});
do_check_property(aTest, testURI, "ref", function (aStr) {
do_check_property(aTest, testURI, "ref", function () {
return aSuffix.substr(1);
});
}

Просмотреть файл

@ -736,7 +736,7 @@ function do_test_uri_with_hash_suffix(aTest, aSuffix) {
do_check_property(aTest, testURI, "pathQueryRef", function (aStr) {
return aStr + aSuffix;
});
do_check_property(aTest, testURI, "ref", function (aStr) {
do_check_property(aTest, testURI, "ref", function () {
return aSuffix.substr(1);
});
}

Просмотреть файл

@ -72,7 +72,7 @@ add_test(function test_sockets() {
null
);
let listener = {
onTransportStatus(aTransport, aStatus, aProgress, aProgressMax) {
onTransportStatus(aTransport, aStatus) {
if (aStatus == Ci.nsISocketTransport.STATUS_CONNECTED_TO) {
gDashboard.requestSockets(function (data) {
gServerSocket.close();

Просмотреть файл

@ -12,7 +12,7 @@ var unsafeAboutModule = {
chan.owner = Services.scriptSecurityManager.getSystemPrincipal();
return chan;
},
getURIFlags(aURI) {
getURIFlags() {
return Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT;
},
};

Просмотреть файл

@ -32,7 +32,7 @@ var cacheFlushObserver = (cacheFlushObserver = {
var currentThread = null;
function make_channel(url, callback, ctx) {
function make_channel(url) {
return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true });
}

Просмотреть файл

@ -21,7 +21,7 @@ ChromeUtils.defineLazyGetter(this, "URL", function () {
var httpServer = null;
function make_channel(url, callback, ctx) {
function make_channel(url) {
return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true });
}

Просмотреть файл

@ -21,7 +21,7 @@ ChromeUtils.defineLazyGetter(this, "URL", function () {
var httpServer = null;
function make_channel(url, callback, ctx) {
function make_channel(url) {
return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true });
}

Просмотреть файл

@ -103,7 +103,7 @@ function openAltChannel() {
var altDataListener = {
buffer: "",
onStartRequest(request) {},
onStartRequest() {},
onDataAvailable(request, stream, offset, count) {
let string = NetUtil.readInputStreamToString(stream, count);
this.buffer += string;
@ -120,7 +120,7 @@ var altDataListener = {
os.close();
}
},
onStopRequest(request, status) {
onStopRequest(request) {
var cc = request.QueryInterface(Ci.nsICacheInfoChannel);
Assert.equal(cc.alternativeDataType, altContentType);
Assert.equal(this.buffer.length, altContent.length);
@ -143,12 +143,12 @@ function openAltChannelWithOriginalContent() {
var originalListener = {
buffer: "",
onStartRequest(request) {},
onStartRequest() {},
onDataAvailable(request, stream, offset, count) {
let string = NetUtil.readInputStreamToString(stream, count);
this.buffer += string;
},
onStopRequest(request, status) {
onStopRequest(request) {
var cc = request.QueryInterface(Ci.nsICacheInfoChannel);
Assert.equal(cc.alternativeDataType, altContentType);
Assert.equal(this.buffer.length, responseContent.length);

Просмотреть файл

@ -63,7 +63,7 @@ AuthPrompt.prototype = {
QueryInterface: ChromeUtils.generateQI(["nsIAuthPrompt"]),
prompt(title, text, realm, save, defaultText, result) {
prompt() {
do_throw("unexpected prompt call");
},
@ -75,7 +75,7 @@ AuthPrompt.prototype = {
return true;
},
promptPassword(title, text, realm, save, pwd) {
promptPassword() {
do_throw("unexpected promptPassword call");
},
};
@ -159,7 +159,7 @@ Test.prototype = {
throw Components.Exception("", Cr.NS_ERROR_ABORT);
},
onDataAvailable(request, stream, offset, count) {
onDataAvailable() {
do_throw("Should not get any data!");
},

Просмотреть файл

@ -42,7 +42,7 @@ AuthPrompt1.prototype = {
QueryInterface: ChromeUtils.generateQI(["nsIAuthPrompt"]),
prompt: function ap1_prompt(title, text, realm, save, defaultText, result) {
prompt: function ap1_prompt() {
do_throw("unexpected prompt call");
},
@ -94,7 +94,7 @@ AuthPrompt1.prototype = {
return true;
},
promptPassword: function ap1_promptPW(title, text, realm, save, pwd) {
promptPassword: function ap1_promptPW() {
do_throw("unexpected promptPassword call");
},
};
@ -117,7 +117,7 @@ AuthPrompt2.prototype = {
return true;
},
asyncPromptAuth: function ap2_async(chan, cb, ctx, lvl, info) {
asyncPromptAuth: function ap2_async() {
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
};
@ -175,7 +175,7 @@ RealmTestRequestor.prototype = {
return false;
},
asyncPromptAuth: function realmtest_async(chan, cb, ctx, lvl, info) {
asyncPromptAuth: function realmtest_async() {
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
};

Просмотреть файл

@ -43,7 +43,7 @@ AuthPrompt1.prototype = {
QueryInterface: ChromeUtils.generateQI(["nsIAuthPrompt"]),
prompt: function ap1_prompt(title, text, realm, save, defaultText, result) {
prompt: function ap1_prompt() {
do_throw("unexpected prompt call");
},
@ -99,7 +99,7 @@ AuthPrompt1.prototype = {
return true;
},
promptPassword: function ap1_promptPW(title, text, realm, save, pwd) {
promptPassword: function ap1_promptPW() {
do_throw("unexpected promptPassword call");
},
};
@ -252,7 +252,7 @@ RealmTestRequestor.prototype = {
return false;
},
asyncPromptAuth: function realmtest_async(chan, cb, ctx, lvl, info) {
asyncPromptAuth: function realmtest_async() {
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
};
@ -377,7 +377,7 @@ function makeChan(
var ChannelCreationObserver = {
QueryInterface: ChromeUtils.generateQI(["nsIObserver"]),
observe(aSubject, aTopic, aData) {
observe(aSubject, aTopic) {
if (aTopic == "http-on-opening-request") {
initialChannelId = aSubject.QueryInterface(Ci.nsIIdentChannel).channelId;
}
@ -666,7 +666,7 @@ async function test_nonascii_xhr() {
await new Promise(resolve => {
let xhr = new XMLHttpRequest();
xhr.open("GET", URL + "/auth/non_ascii", true, "é", "é");
xhr.onreadystatechange = function (event) {
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
Assert.equal(xhr.status, 200);
resolve();

Просмотреть файл

@ -51,7 +51,7 @@ function run_test() {
QueryInterface: ChromeUtils.generateQI(["nsIAuthPrompt"]),
prompt: function ap1_prompt(title, text, realm, save, defaultText, result) {
prompt: function ap1_prompt(title, text, realm) {
this.called |= CALLED_PROMPT;
this.doChecks(text, realm);
return this.rv;

Просмотреть файл

@ -213,11 +213,7 @@ function promiseCopyToSaver(aSourceString, aSaverOutputStream, aCloseWhenDone) {
* @resolves When the operation completes with a success code.
* @rejects With an exception, if the operation fails.
*/
function promisePumpToSaver(
aSourceString,
aSaverStreamListener,
aCloseWhenDone
) {
function promisePumpToSaver(aSourceString, aSaverStreamListener) {
return new Promise((resolve, reject) => {
aSaverStreamListener.QueryInterface(Ci.nsIStreamListener);
let inputStream = new StringInputStream(
@ -603,7 +599,7 @@ add_task(async function test_enableAppend_hash() {
add_task(async function test_finish_only() {
// This test checks creating the object and doing nothing.
let saver = new BackgroundFileSaverOutputStream();
function onTargetChange(aTarget) {
function onTargetChange() {
do_throw("Should not receive the onTargetChange notification.");
}
let completionPromise = promiseSaverComplete(saver, onTargetChange);

Просмотреть файл

@ -169,7 +169,7 @@ function startClient(port, beConservative, expectSuccess) {
req.open("GET", `https://${hostname}:${port}`);
let internalChannel = req.channel.QueryInterface(Ci.nsIHttpChannelInternal);
internalChannel.beConservative = beConservative;
return new Promise((resolve, reject) => {
return new Promise(resolve => {
req.onload = () => {
ok(
expectSuccess,

Просмотреть файл

@ -151,7 +151,7 @@ function startClient(port, beConservative, expectSuccess) {
req.open("GET", `https://${hostname}:${port}`);
let internalChannel = req.channel.QueryInterface(Ci.nsIHttpChannelInternal);
internalChannel.beConservative = beConservative;
return new Promise((resolve, reject) => {
return new Promise(resolve => {
req.onload = () => {
ok(
expectSuccess,

Просмотреть файл

@ -26,7 +26,7 @@ let channelListener = function (closure) {
};
channelListener.prototype = {
onStartRequest: function testOnStartRequest(request) {},
onStartRequest: function testOnStartRequest() {},
onDataAvailable: function testOnDataAvailable(request, stream, off, cnt) {
let data = read_stream(stream, cnt);
@ -39,7 +39,7 @@ channelListener.prototype = {
}
},
onStopRequest: function testOnStopRequest(request, status) {
onStopRequest: function testOnStopRequest() {
this._closure();
},
};

Просмотреть файл

@ -22,7 +22,7 @@ ChromeUtils.defineLazyGetter(this, "URL", function () {
var httpServer = null;
function make_channel(url, callback, ctx) {
function make_channel(url) {
return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true });
}

Просмотреть файл

@ -55,9 +55,9 @@ async function TestProxyType(chan, flags) {
Ci.nsIProtocolProxyService.PROXYCONFIG_SYSTEM
);
return new Promise((resolve, reject) => {
return new Promise(resolve => {
gProxyService.asyncResolve(chan, flags, {
onProxyAvailable(req, uri, pi, status) {
onProxyAvailable(req, uri, pi) {
resolve(pi);
},
});

Просмотреть файл

@ -45,7 +45,7 @@ Listener.prototype = {
}
},
onStopRequest(request, status) {
onStopRequest() {
if (pass == 0) {
Assert.equal(this._buffer.length, responseLen);
pass++;

Просмотреть файл

@ -90,11 +90,11 @@ function HttpResponseListener(id) {
}
HttpResponseListener.prototype = {
onStartRequest(request) {},
onStartRequest() {},
onDataAvailable(request, stream, off, cnt) {},
onDataAvailable() {},
onStopRequest(request, status) {
onStopRequest() {
log("STOP id=" + this.id);
do_test_finished();
},

Просмотреть файл

@ -99,11 +99,11 @@ function HttpResponseListener(id) {
}
HttpResponseListener.prototype = {
onStartRequest(request) {},
onStartRequest() {},
onDataAvailable(request, stream, off, cnt) {},
onDataAvailable() {},
onStopRequest(request, status) {
onStopRequest() {
log("STOP id=" + this.id);
do_test_finished();
},

Просмотреть файл

@ -134,11 +134,11 @@ function HttpResponseListener(id, onStopCallback) {
}
HttpResponseListener.prototype = {
onStartRequest(request) {},
onStartRequest() {},
onDataAvailable(request, stream, off, cnt) {},
onDataAvailable() {},
onStopRequest(request, status) {
onStopRequest() {
log("STOP id=" + this.id);
do_test_finished();
if (this.stopCallback) {

Просмотреть файл

@ -113,11 +113,11 @@ function HttpResponseListener(id) {
}
HttpResponseListener.prototype = {
onStartRequest(request) {},
onStartRequest() {},
onDataAvailable(request, stream, off, cnt) {},
onDataAvailable() {},
onStopRequest(request, status) {
onStopRequest() {
log("STOP id=" + this.id);
do_test_finished();
},

Просмотреть файл

@ -72,9 +72,9 @@ function HttpResponseListener(id, onStopRequestStatus) {
}
HttpResponseListener.prototype = {
onStartRequest(request) {},
onStartRequest() {},
onDataAvailable(request, stream, off, cnt) {},
onDataAvailable() {},
onStopRequest(request, status) {
log("STOP id=" + this.id + " status=" + status);

Просмотреть файл

@ -25,7 +25,7 @@ ChromeUtils.defineLazyGetter(this, "URL", function () {
var httpServer = null;
function make_channel(url, callback, ctx) {
function make_channel(url) {
return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true });
}

Просмотреть файл

@ -66,7 +66,7 @@ function channelOpenPromise(chan) {
let topic = "http-on-transaction-suspended-authentication";
let observer = {
QueryInterface: ChromeUtils.generateQI(["nsIObserver"]),
observe(aSubject, aTopic, aData) {
observe(aSubject, aTopic) {
if (aTopic == topic) {
Services.obs.removeObserver(observer, topic);
let channel = aSubject.QueryInterface(Ci.nsIChannel);

Просмотреть файл

@ -11,7 +11,7 @@ function run_test() {
"nsIRequestObserver",
]),
onStartRequest(aRequest) {},
onStartRequest() {},
onStopRequest(aRequest, aStatusCode) {
// Make sure we can catch the error NS_ERROR_FILE_NOT_FOUND here.
@ -19,7 +19,7 @@ function run_test() {
do_test_finished();
},
onDataAvailable(aRequest, aStream, aOffset, aCount) {
onDataAvailable() {
do_throw("The channel must not call onDataAvailable().");
},
};

Просмотреть файл

@ -8,8 +8,8 @@ var server;
const BUGID = "331825";
function TestListener() {}
TestListener.prototype.onStartRequest = function (request) {};
TestListener.prototype.onStopRequest = function (request, status) {
TestListener.prototype.onStartRequest = function () {};
TestListener.prototype.onStopRequest = function (request) {
var channel = request.QueryInterface(Ci.nsIHttpChannel);
Assert.equal(channel.responseStatus, 304);

Просмотреть файл

@ -29,7 +29,7 @@ TestListener.prototype.onStartRequest = function (request) {
throw ex;
}
};
TestListener.prototype.onStopRequest = function (request, status) {
TestListener.prototype.onStopRequest = function () {
try {
change_content_type();
} catch (ex) {
@ -68,6 +68,6 @@ function run_test() {
}
// PATH HANDLER FOR /bug369787
function bug369787(metadata, response) {
function bug369787() {
/* do nothing */
}

Просмотреть файл

@ -14,12 +14,12 @@ function redirectHandler(metadata, response) {
response.setHeader("Location", noRedirectURI, false);
}
function contentHandler(metadata, response) {
function contentHandler(metadata) {
Assert.equal(metadata.getHeader("Accept"), acceptType);
httpserver.stop(do_test_finished);
}
function dummyHandler(request, buffer) {}
function dummyHandler() {}
function run_test() {
httpserver = new HttpServer();

Просмотреть файл

@ -8,9 +8,9 @@ var httpserv;
function TestListener() {}
TestListener.prototype.onStartRequest = function (request) {};
TestListener.prototype.onStartRequest = function () {};
TestListener.prototype.onStopRequest = function (request, status) {
TestListener.prototype.onStopRequest = function () {
httpserv.stop(do_test_finished);
};
@ -34,7 +34,7 @@ function run_test() {
do_test_pending();
}
function bug412945(metadata, response) {
function bug412945(metadata) {
if (
!metadata.hasHeader("Content-Length") ||
metadata.getHeader("Content-Length") != "0"

Просмотреть файл

@ -25,7 +25,7 @@ NotificationCallbacks.prototype = {
getInterface(iid) {
return this.QueryInterface(iid);
},
asyncOnChannelRedirect(oldChan, newChan, flags, callback) {
asyncOnChannelRedirect(oldChan, newChan) {
Assert.equal(oldChan.URI.spec, this._origURI.spec);
Assert.equal(oldChan.URI, this._origURI);
Assert.equal(oldChan.originalURI.spec, this._origURI.spec);
@ -54,7 +54,7 @@ RequestObserver.prototype = {
Assert.equal(chan.originalURI.spec, this._origURI.spec);
Assert.equal(chan.originalURI, this._origURI);
},
onDataAvailable(req, stream, offset, count) {
onDataAvailable() {
do_throw("Unexpected call to onDataAvailable");
},
onStopRequest(req, status) {

Просмотреть файл

@ -58,7 +58,7 @@ function triggerNextTest() {
channel.asyncOpen(new ChannelListener(checkValueAndTrigger, null));
}
function checkValueAndTrigger(request, data, ctx) {
function checkValueAndTrigger(request, data) {
Assert.equal(tests[index].expected, data);
if (index < tests.length - 1) {

Просмотреть файл

@ -101,7 +101,7 @@ function triggerNextTest() {
channel.asyncOpen(new ChannelListener(checkValueAndTrigger, null));
}
function checkValueAndTrigger(request, data, ctx) {
function checkValueAndTrigger(request, data) {
logit(index, data);
Assert.equal(tests[index].expected, data);

Просмотреть файл

@ -26,7 +26,7 @@ var test_sink_closed;
var test_nr;
var copyObserver = {
onStartRequest(request) {},
onStartRequest() {},
onStopRequest(request, statusCode) {
// check status code

Просмотреть файл

@ -13,7 +13,7 @@ var buffer = "";
var observer = {
QueryInterface: ChromeUtils.generateQI(["nsIObserver"]),
observe(subject, topic, data) {
observe(subject, topic) {
if (observers_called.length) {
observers_called += ",";
}
@ -23,7 +23,7 @@ var observer = {
};
var listener = {
onStartRequest(request) {
onStartRequest() {
buffer = "";
},
@ -259,6 +259,6 @@ function bug482601_cached(metadata, response) {
}
// /bug482601/only_from_cache
function bug482601_only_from_cache(metadata, response) {
function bug482601_only_from_cache() {
do_throw("This should not be reached");
}

Просмотреть файл

@ -91,7 +91,7 @@ add_test(() => {
var ch = make_channel(resource_url);
ch.asyncOpen(
new ChannelListener(function (aRequest, aData) {
new ChannelListener(function (aRequest) {
syncWithCacheIOThread(() => {
Assert.ok(hit_server);
Assert.equal(
@ -117,7 +117,7 @@ add_test(() => {
var ch = make_channel(resource_url);
ch.asyncOpen(
new ChannelListener(function (aRequest, aData) {
new ChannelListener(function (aRequest) {
syncWithCacheIOThread(() => {
Assert.ok(hit_server);
Assert.equal(
@ -170,7 +170,7 @@ add_test(() => {
response_time = "Sat, 3 Jan 2009 00:00:00 GMT";
var ch = make_channel(resource_url);
ch.asyncOpen(
new ChannelListener(function (aRequest, aData) {
new ChannelListener(function (aRequest) {
syncWithCacheIOThread(() => {
Assert.ok(hit_server);
Assert.equal(

Просмотреть файл

@ -79,7 +79,7 @@ function triggerNextTest() {
channel.asyncOpen(new ChannelListener(checkValueAndTrigger, null));
}
function checkValueAndTrigger(request, data, ctx) {
function checkValueAndTrigger(request, data) {
logit(index, data);
Assert.equal(tests[index].expected, data);

Просмотреть файл

@ -28,7 +28,7 @@ function triggerNextTest() {
channel.asyncOpen(new ChannelListener(checkValueAndTrigger, null));
}
function checkValueAndTrigger(request, data, ctx) {
function checkValueAndTrigger(request, data) {
Assert.equal(tests[index].expected, data);
if (index < tests.length - 1) {

Просмотреть файл

@ -14,16 +14,16 @@ const CONTENT_LENGTH = "1152921504606846975";
var httpServer = null;
var listener = {
onStartRequest(req) {},
onStartRequest() {},
onDataAvailable(req, stream, off, count) {
onDataAvailable(req) {
Assert.equal(req.getResponseHeader("Content-Length"), CONTENT_LENGTH);
// We're done here, cancel the channel
req.cancel(Cr.NS_BINDING_ABORTED);
},
onStopRequest(req, stat) {
onStopRequest() {
httpServer.stop(do_test_finished);
},
};

Просмотреть файл

@ -4,7 +4,7 @@
"use strict";
function continue_test(status, entry) {
function continue_test(status) {
Assert.equal(status, Cr.NS_OK);
// TODO - mayhemer: remove this tests completely
// entry.deviceID;

Просмотреть файл

@ -17,9 +17,9 @@ for (let i = 0; i < 10000; i++) {
}
var listener = {
onStartRequest(request) {},
onStartRequest() {},
onDataAvailable(request, stream) {},
onDataAvailable() {},
onStopRequest(request, status) {
Assert.equal(status, Cr.NS_OK);

Просмотреть файл

@ -22,7 +22,7 @@ function setupChannel(suffix) {
return httpChan;
}
function checkValueAndTrigger(request, data, ctx) {
function checkValueAndTrigger(request, data) {
Assert.equal("Ok", data);
httpserver.stop(do_test_finished);
}

Просмотреть файл

@ -15,13 +15,13 @@ ChromeUtils.defineLazyGetter(this, "systemSettings", function () {
mainThreadOnly: true,
PACURI: "http://localhost:" + httpserv.identity.primaryPort + "/redirect",
getProxyForURI(aURI) {
getProxyForURI() {
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
};
});
function checkValue(request, data, ctx) {
function checkValue(request, data) {
Assert.ok(called);
Assert.equal("ok", data);
httpserv.stop(do_test_finished);

Просмотреть файл

@ -39,13 +39,13 @@ Listener.prototype = {
"nsIRequestObserver",
]),
onStartRequest(request) {
onStartRequest() {
this._buffer = "";
},
onDataAvailable(request, stream, offset, count) {
this._buffer = this._buffer.concat(read_stream(stream, count));
},
onStopRequest(request, status) {
onStopRequest() {
Assert.equal(this._buffer, this._response);
if (--expectedOnStopRequests == 0) {
do_timeout(10, function () {

Просмотреть файл

@ -29,8 +29,8 @@ function setupChannel(path) {
// Verify that Content-Location-URI has been loaded once, load post_target
function InitialListener() {}
InitialListener.prototype = {
onStartRequest(request) {},
onStopRequest(request, status) {
onStartRequest() {},
onStopRequest() {
Assert.equal(1, numberOfCLHandlerCalls);
executeSoon(function () {
var channel = setupChannel(
@ -45,8 +45,8 @@ InitialListener.prototype = {
// Verify that Location-URI has been loaded once, reload post_target
function RedirectingListener() {}
RedirectingListener.prototype = {
onStartRequest(request) {},
onStopRequest(request, status) {
onStartRequest() {},
onStopRequest() {
Assert.equal(1, numberOfHandlerCalls);
executeSoon(function () {
var channel = setupChannel(
@ -62,8 +62,8 @@ RedirectingListener.prototype = {
// reload Content-Location-URI
function VerifyingListener() {}
VerifyingListener.prototype = {
onStartRequest(request) {},
onStopRequest(request, status) {
onStartRequest() {},
onStopRequest() {
Assert.equal(2, numberOfHandlerCalls);
var channel = setupChannel(
"http://localhost:" + httpserv.identity.primaryPort + "/cl"
@ -76,8 +76,8 @@ VerifyingListener.prototype = {
// stop test
function FinalListener() {}
FinalListener.prototype = {
onStartRequest(request) {},
onStopRequest(request, status) {
onStartRequest() {},
onStopRequest() {
Assert.equal(2, numberOfCLHandlerCalls);
httpserv.stop(do_test_finished);
},

Просмотреть файл

@ -10,7 +10,7 @@ const CACHECTRL_HDR_NAME = "X-CACHE-CONTROL-HEADER";
var httpserver = null;
function make_channel(flags, vary, value) {
function make_channel() {
var chan = NetUtil.newChannel({
uri: "http://localhost:" + httpserver.identity.primaryPort + "/bug633743",
loadUsingSystemPrincipal: true,
@ -39,13 +39,13 @@ Test.prototype = {
"nsIRequestObserver",
]),
onStartRequest(request) {},
onStartRequest() {},
onDataAvailable(request, stream, offset, count) {
this._buffer = this._buffer.concat(read_stream(stream, count));
},
onStopRequest(request, status) {
onStopRequest() {
Assert.equal(this._buffer, this._expectVal);
do_timeout(0, run_next_test);
},

Просмотреть файл

@ -158,7 +158,7 @@ function TestCacheEntrySize(
channel.asyncOpen(new ChannelListener(ctx.testAndTriggerNext, ctx));
});
};
this.testAndTriggerNext = function (request, data, ctx) {
this.testAndTriggerNext = function (request, data) {
Assert.equal(secondExpectedReply, data);
executeSoon(nextTest);
};

Просмотреть файл

@ -13,7 +13,7 @@ function setupChannel(suffix) {
});
}
function checkValueAndTrigger(request, data, ctx) {
function checkValueAndTrigger(request, data) {
Assert.equal("Ok", data);
httpserver.stop(do_test_finished);
}

Просмотреть файл

@ -35,7 +35,7 @@ var listener_proto = {
request.cancel(Cr.NS_BINDING_ABORTED);
},
onDataAvailable(request, stream, offset, count) {
onDataAvailable() {
do_throw("Unexpected onDataAvailable");
},

Просмотреть файл

@ -28,13 +28,13 @@ var fetched;
var tests = [
{
prepare() {},
test(response) {
test() {
Assert.ok(fetched);
},
},
{
prepare() {},
test(response) {
test() {
Assert.ok(!fetched);
},
},
@ -42,13 +42,13 @@ var tests = [
prepare() {
setUA("A different User Agent");
},
test(response) {
test() {
Assert.ok(fetched);
},
},
{
prepare() {},
test(response) {
test() {
Assert.ok(!fetched);
},
},
@ -56,13 +56,13 @@ var tests = [
prepare() {
setUA("And another User Agent");
},
test(response) {
test() {
Assert.ok(fetched);
},
},
{
prepare() {},
test(response) {
test() {
Assert.ok(!fetched);
},
},

Просмотреть файл

@ -25,7 +25,7 @@ ChromeUtils.defineLazyGetter(this, "randomURI2", function () {
return "http://localhost:" + httpserver.identity.primaryPort + randomPath2;
});
function make_channel(url, callback, ctx) {
function make_channel(url) {
return NetUtil.newChannel({ uri: url, loadUsingSystemPrincipal: true });
}

Просмотреть файл

@ -55,7 +55,7 @@ RequestObserver.prototype = {
"nsISupportsWeakReference",
]),
observe(subject, topic, data) {
observe(subject, topic) {
if (topic == notification) {
if (!(subject instanceof Ci.nsIHttpChannel)) {
do_throw(notification + " observed a non-HTTP channel.");
@ -76,13 +76,13 @@ RequestObserver.prototype = {
};
var listener = {
onStartRequest: function test_onStartR(request) {},
onStartRequest: function test_onStartR() {},
onDataAvailable: function test_ODA() {
do_throw("Should not get any data!");
},
onStopRequest: function test_onStopR(request, status) {
onStopRequest: function test_onStopR() {
if (current_test < tests.length - 1) {
current_test++;
tests[current_test]();

Просмотреть файл

@ -25,7 +25,7 @@ ProtocolHandler.prototype = {
this.loadInfo = aLoadInfo;
return this;
},
allowPort(port, scheme) {
allowPort(port) {
return port != -1;
},
@ -67,7 +67,7 @@ ProtocolHandler.prototype = {
loadUsingSystemPrincipal: true,
}).open();
},
asyncOpen(aListener, aContext) {
asyncOpen() {
throw Components.Exception("Not implemented", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
contentDisposition: Ci.nsIChannel.DISPOSITION_INLINE,
@ -86,7 +86,7 @@ ProtocolHandler.prototype = {
get status() {
return Cr.NS_OK;
},
cancel(status) {},
cancel() {},
loadGroup: null,
loadFlags:
Ci.nsIRequest.LOAD_NORMAL |

Просмотреть файл

@ -106,7 +106,7 @@ add_test(() => {
// Must not create a cache entry
var ch = make_channel(resource_age_100_url, "no-store");
ch.asyncOpen(
new ChannelListener(function (request, data) {
new ChannelListener(function () {
Assert.ok(hit_server);
Assert.ok(!cache.exists(make_uri(resource_age_100_url), ""));
@ -119,7 +119,7 @@ add_test(() => {
// Prepare state only, cache the entry
var ch = make_channel(resource_age_100_url);
ch.asyncOpen(
new ChannelListener(function (request, data) {
new ChannelListener(function () {
Assert.ok(hit_server);
Assert.ok(cache.exists(make_uri(resource_age_100_url), ""));
@ -132,7 +132,7 @@ add_test(() => {
// Check the prepared cache entry is used when no special directives are added
var ch = make_channel(resource_age_100_url);
ch.asyncOpen(
new ChannelListener(function (request, data) {
new ChannelListener(function () {
Assert.ok(!hit_server);
Assert.ok(cache.exists(make_uri(resource_age_100_url), ""));
@ -146,7 +146,7 @@ add_test(() => {
// the channel must not use it, entry should stay in the cache
var ch = make_channel(resource_age_100_url, "no-store");
ch.asyncOpen(
new ChannelListener(function (request, data) {
new ChannelListener(function () {
Assert.ok(hit_server);
Assert.ok(cache.exists(make_uri(resource_age_100_url), ""));
@ -162,7 +162,7 @@ add_test(() => {
// Check the prepared cache entry is used when no special directives are added
var ch = make_channel(resource_age_100_url);
ch.asyncOpen(
new ChannelListener(function (request, data) {
new ChannelListener(function () {
Assert.ok(!hit_server);
Assert.ok(cache.exists(make_uri(resource_age_100_url), ""));
@ -175,7 +175,7 @@ add_test(() => {
// The existing entry should be revalidated (we expect a server hit)
var ch = make_channel(resource_age_100_url, "no-cache");
ch.asyncOpen(
new ChannelListener(function (request, data) {
new ChannelListener(function () {
Assert.ok(hit_server);
Assert.ok(cache.exists(make_uri(resource_age_100_url), ""));
@ -191,7 +191,7 @@ add_test(() => {
// Check the prepared cache entry is used when no special directives are added
var ch = make_channel(resource_age_100_url);
ch.asyncOpen(
new ChannelListener(function (request, data) {
new ChannelListener(function () {
Assert.ok(!hit_server);
Assert.ok(cache.exists(make_uri(resource_age_100_url), ""));
@ -205,7 +205,7 @@ add_test(() => {
// should hit server
var ch = make_channel(resource_age_100_url, "max-age=10");
ch.asyncOpen(
new ChannelListener(function (request, data) {
new ChannelListener(function () {
Assert.ok(hit_server);
Assert.ok(cache.exists(make_uri(resource_age_100_url), ""));
@ -219,7 +219,7 @@ add_test(() => {
// but the max-stale directive says to use it when it's fresh enough
var ch = make_channel(resource_age_100_url, "max-age=10, max-stale=99999");
ch.asyncOpen(
new ChannelListener(function (request, data) {
new ChannelListener(function () {
Assert.ok(!hit_server);
Assert.ok(cache.exists(make_uri(resource_age_100_url), ""));
@ -233,7 +233,7 @@ add_test(() => {
// should go from cache
var ch = make_channel(resource_age_100_url, "max-age=1000");
ch.asyncOpen(
new ChannelListener(function (request, data) {
new ChannelListener(function () {
Assert.ok(!hit_server);
Assert.ok(cache.exists(make_uri(resource_age_100_url), ""));
@ -249,7 +249,7 @@ add_test(() => {
// Preprate the entry first
var ch = make_channel(resource_stale_100_url);
ch.asyncOpen(
new ChannelListener(function (request, data) {
new ChannelListener(function () {
Assert.ok(hit_server);
Assert.ok(cache.exists(make_uri(resource_stale_100_url), ""));
@ -264,7 +264,7 @@ add_test(() => {
// are provided
var ch = make_channel(resource_stale_100_url);
ch.asyncOpen(
new ChannelListener(function (request, data) {
new ChannelListener(function () {
Assert.ok(hit_server);
Assert.ok(cache.exists(make_uri(resource_stale_100_url), ""));
@ -277,7 +277,7 @@ add_test(() => {
// Accept cached responses of any stale time
var ch = make_channel(resource_stale_100_url, "max-stale");
ch.asyncOpen(
new ChannelListener(function (request, data) {
new ChannelListener(function () {
Assert.ok(!hit_server);
Assert.ok(cache.exists(make_uri(resource_stale_100_url), ""));
@ -290,7 +290,7 @@ add_test(() => {
// The entry is stale only by 100 seconds, accept it
var ch = make_channel(resource_stale_100_url, "max-stale=1000");
ch.asyncOpen(
new ChannelListener(function (request, data) {
new ChannelListener(function () {
Assert.ok(!hit_server);
Assert.ok(cache.exists(make_uri(resource_stale_100_url), ""));
@ -304,7 +304,7 @@ add_test(() => {
// entry, go from server
var ch = make_channel(resource_stale_100_url, "max-stale=10");
ch.asyncOpen(
new ChannelListener(function (request, data) {
new ChannelListener(function () {
Assert.ok(hit_server);
Assert.ok(cache.exists(make_uri(resource_stale_100_url), ""));
@ -320,7 +320,7 @@ add_test(() => {
// Preprate the entry first
var ch = make_channel(resource_fresh_100_url);
ch.asyncOpen(
new ChannelListener(function (request, data) {
new ChannelListener(function () {
Assert.ok(hit_server);
Assert.ok(cache.exists(make_uri(resource_fresh_100_url), ""));
@ -333,7 +333,7 @@ add_test(() => {
// Check it's reused when no special directives are provided
var ch = make_channel(resource_fresh_100_url);
ch.asyncOpen(
new ChannelListener(function (request, data) {
new ChannelListener(function () {
Assert.ok(!hit_server);
Assert.ok(cache.exists(make_uri(resource_fresh_100_url), ""));
@ -346,7 +346,7 @@ add_test(() => {
// Entry fresh enough to be served from the cache
var ch = make_channel(resource_fresh_100_url, "min-fresh=10");
ch.asyncOpen(
new ChannelListener(function (request, data) {
new ChannelListener(function () {
Assert.ok(!hit_server);
Assert.ok(cache.exists(make_uri(resource_fresh_100_url), ""));
@ -359,7 +359,7 @@ add_test(() => {
// The entry is not fresh enough
var ch = make_channel(resource_fresh_100_url, "min-fresh=1000");
ch.asyncOpen(
new ChannelListener(function (request, data) {
new ChannelListener(function () {
Assert.ok(hit_server);
Assert.ok(cache.exists(make_uri(resource_fresh_100_url), ""));
@ -378,7 +378,7 @@ add_test(() => {
'unknown1,unknown2 = "a,b", min-fresh = 1000 '
);
ch.asyncOpen(
new ChannelListener(function (request, data) {
new ChannelListener(function () {
Assert.ok(hit_server);
Assert.ok(cache.exists(make_uri(resource_fresh_100_url), ""));
@ -390,7 +390,7 @@ add_test(() => {
add_test(() => {
var ch = make_channel(resource_fresh_100_url, "no-cache = , min-fresh = 10");
ch.asyncOpen(
new ChannelListener(function (request, data) {
new ChannelListener(function () {
Assert.ok(hit_server);
Assert.ok(cache.exists(make_uri(resource_fresh_100_url), ""));

Просмотреть файл

@ -126,7 +126,7 @@ add_task(async function test() {
onCacheEntryCheck() {
return Ci.nsICacheEntryOpenCallback.ENTRY_WANTED;
},
onCacheEntryAvailable(entry, isnew, status) {
onCacheEntryAvailable() {
info("opened");
r2();
},
@ -154,17 +154,7 @@ add_task(async function test() {
let entryCount = 0;
let visitor = {
onCacheStorageInfo() {},
async onCacheEntryInfo(
aURI,
aIdEnhance,
aDataSize,
aAltDataSize,
aFetchCount,
aLastModifiedTime,
aExpirationTime,
aPinned,
aInfo
) {
async onCacheEntryInfo() {
entryCount++;
},
onCacheEntryVisitCompleted() {

Просмотреть файл

@ -8,7 +8,7 @@ function run_test() {
"disk",
Ci.nsICacheStorage.OPEN_NORMALLY,
null,
new OpenCallback(NEW, "a1m", "a1d", function (entry) {
new OpenCallback(NEW, "a1m", "a1d", function () {
var storage = getCacheStorage("memory");
// Have to fail
storage.asyncDoomURI(

Просмотреть файл

@ -8,7 +8,7 @@ function run_test() {
"disk",
Ci.nsICacheStorage.OPEN_NORMALLY,
null,
new OpenCallback(NEW, "x1m", "x1d", function (entry) {
new OpenCallback(NEW, "x1m", "x1d", function () {
// nothing to do here, we expect concurent callbacks to get
// all notified, then the test finishes
})
@ -21,7 +21,7 @@ function run_test() {
"disk",
Ci.nsICacheStorage.OPEN_NORMALLY,
null,
new OpenCallback(NORMAL, "x1m", "x1d", function (entry) {
new OpenCallback(NORMAL, "x1m", "x1d", function () {
mc.fired();
})
);
@ -30,7 +30,7 @@ function run_test() {
"disk",
Ci.nsICacheStorage.OPEN_NORMALLY,
null,
new OpenCallback(NORMAL, "x1m", "x1d", function (entry) {
new OpenCallback(NORMAL, "x1m", "x1d", function () {
mc.fired();
})
);
@ -39,7 +39,7 @@ function run_test() {
"disk",
Ci.nsICacheStorage.OPEN_NORMALLY,
null,
new OpenCallback(NORMAL, "x1m", "x1d", function (entry) {
new OpenCallback(NORMAL, "x1m", "x1d", function () {
mc.fired();
})
);

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше