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

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

@ -29,7 +29,7 @@ add_setup(async function () {
function waitForNotificationPromise(notification, expected) { function waitForNotificationPromise(notification, expected) {
return new Promise(resolve => { return new Promise(resolve => {
function observer(subject, topic, data) { function observer() {
is(content.document.cookie, expected); is(content.document.cookie, expected);
Services.obs.removeObserver(observer, notification); Services.obs.removeObserver(observer, notification);
resolve(); resolve();
@ -70,7 +70,7 @@ add_task(async function test_purge_sync_batch_and_deleted() {
() => content.document.cookie == "", () => content.document.cookie == "",
"cookie did not expire in time", "cookie did not expire in time",
200 200
).catch(msg => { ).catch(() => {
is(false, "Cookie did not expire in time"); 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(); reject();
}; };
}); });
@ -76,7 +76,7 @@ CookiePolicyHelper.runTest("IndexedDB in workers", {
} }
}; };
worker.onerror = function (e) { worker.onerror = function () {
reject(); reject();
}; };
}); });

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -22,7 +22,7 @@ function run_test() {
const REQUEST_DATA = "12345678901234567"; const REQUEST_DATA = "12345678901234567";
function contentLength(request, response) { function contentLength(request) {
Assert.equal(request.method, "POST"); Assert.equal(request.method, "POST");
Assert.equal(request.getHeader("Content-Length"), "017"); 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"); checkStatusLine(ch, 1, 1, 500, "Internal Server Error");
} }
function succeeded(ch, status, data) { function succeeded(ch, status) {
Assert.ok(Components.isSuccessCode(status)); Assert.ok(Components.isSuccessCode(status));
} }
function register400Handler(ch) { function register400Handler() {
srv.registerErrorHandler(400, throwsException); srv.registerErrorHandler(400, throwsException);
} }
// PATH HANDLERS // PATH HANDLERS
// /throws/exception (and also a 404 and 400 error handler) // /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..."); throw new Error("this shouldn't cause an exit...");
do_throw("Not reached!"); // eslint-disable-line no-unreachable do_throw("Not reached!"); // eslint-disable-line no-unreachable
} }

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

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

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

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

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

@ -69,11 +69,11 @@ ChromeUtils.defineLazyGetter(this, "tests", function () {
}); });
// /no/setstatusline // /no/setstatusline
function noSetstatusline(metadata, response) {} function noSetstatusline() {}
function startNoSetStatusLine(ch) { function startNoSetStatusLine(ch) {
checkStatusLine(ch, 1, 1, 200, "OK"); checkStatusLine(ch, 1, 1, 200, "OK");
} }
function stop(ch, status, data) { function stop(ch, status) {
Assert.ok(Components.isSuccessCode(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 // extension of the file on the server, not by the extension of the requested
// path. // path.
function setupFileMapping(ch) { function setupFileMapping() {
srv.registerFile("/script.html", sjs); srv.registerFile("/script.html", sjs);
} }

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

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

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

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

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

@ -13,7 +13,7 @@ SimpleTest.waitForExplicitFinish();
var script = SpecialPowers.loadChromeScript(() => { var script = SpecialPowers.loadChromeScript(() => {
/* eslint-env mozilla/chrome-script */ /* 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); let channel = subject.QueryInterface(Ci.nsIHttpChannel);
if (!channel.URI.spec.startsWith("http://example.org")) { if (!channel.URI.spec.startsWith("http://example.org")) {
return; return;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -95,7 +95,7 @@ function firstTimeThrough(request, buffer) {
Assert.ok(gMockPromptService.firstTimeCalled, "Prompt service invoked"); Assert.ok(gMockPromptService.firstTimeCalled, "Prompt service invoked");
} }
function secondTimeThrough(request, buffer) { function secondTimeThrough(request) {
Assert.equal(request.status, Cr.NS_ERROR_SUPERFLUOS_AUTH); Assert.equal(request.status, Cr.NS_ERROR_SUPERFLUOS_AUTH);
httpServer.stop(do_test_finished); 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) { do_check_property(aTest, testURI, "pathQueryRef", function (aStr) {
return aStr + aSuffix; return aStr + aSuffix;
}); });
do_check_property(aTest, testURI, "ref", function (aStr) { do_check_property(aTest, testURI, "ref", function () {
return aSuffix.substr(1); 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) { do_check_property(aTest, testURI, "pathQueryRef", function (aStr) {
return aStr + aSuffix; return aStr + aSuffix;
}); });
do_check_property(aTest, testURI, "ref", function (aStr) { do_check_property(aTest, testURI, "ref", function () {
return aSuffix.substr(1); return aSuffix.substr(1);
}); });
} }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -51,7 +51,7 @@ function run_test() {
QueryInterface: ChromeUtils.generateQI(["nsIAuthPrompt"]), 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.called |= CALLED_PROMPT;
this.doChecks(text, realm); this.doChecks(text, realm);
return this.rv; return this.rv;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -8,9 +8,9 @@ var httpserv;
function TestListener() {} 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); httpserv.stop(do_test_finished);
}; };
@ -34,7 +34,7 @@ function run_test() {
do_test_pending(); do_test_pending();
} }
function bug412945(metadata, response) { function bug412945(metadata) {
if ( if (
!metadata.hasHeader("Content-Length") || !metadata.hasHeader("Content-Length") ||
metadata.getHeader("Content-Length") != "0" metadata.getHeader("Content-Length") != "0"

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

@ -25,7 +25,7 @@ NotificationCallbacks.prototype = {
getInterface(iid) { getInterface(iid) {
return this.QueryInterface(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.spec, this._origURI.spec);
Assert.equal(oldChan.URI, this._origURI); Assert.equal(oldChan.URI, this._origURI);
Assert.equal(oldChan.originalURI.spec, this._origURI.spec); 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.spec, this._origURI.spec);
Assert.equal(chan.originalURI, this._origURI); Assert.equal(chan.originalURI, this._origURI);
}, },
onDataAvailable(req, stream, offset, count) { onDataAvailable() {
do_throw("Unexpected call to onDataAvailable"); do_throw("Unexpected call to onDataAvailable");
}, },
onStopRequest(req, status) { onStopRequest(req, status) {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -8,7 +8,7 @@ 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 () {
var storage = getCacheStorage("memory"); var storage = getCacheStorage("memory");
// Have to fail // Have to fail
storage.asyncDoomURI( storage.asyncDoomURI(

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

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

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