function startChannelRequest(uri, flags, callback) { var chan = NetUtil.newChannel({
uri,
loadUsingSystemPrincipal: true,
});
chan.asyncOpen(new ChannelListener(callback, null, flags));
}
// We first make a request that we'll cancel asynchronously. The response will // still contain the set-cookie header. Then verify the cookie was not actually // retained.
add_test(function testAsyncCancel() {
onExamineListener(chan => { // Suspend the channel then yield to make this async.
chan.suspend();
Promise.resolve().then(() => {
chan.cancel(Cr.NS_BINDING_ABORTED);
chan.resume();
});
});
startChannelRequest(baseUrl, CL_EXPECT_FAILURE, (request, data) => { Assert.ok(!data, "no response");
Assert.equal(
Services.cookies.countCookiesFromHost("localhost"),
0, "no cookies set"
);
executeSoon(run_next_test);
});
});
function run_test() { var httpServer = new HttpServer();
httpServer.registerPathHandler("/", responseHandler);
httpServer.start(-1);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.