mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
bug 1452139 - Don't include cookies when posting Telemetry r=gfritzsche,franziskus
We don't need or want cookies sent to incoming.tmo. It just throws them on the floor, but we needn't waste clients' bandwidth on it. MozReview-Commit-ID: F9WjcDyKFGN
This commit is contained in:
parent
94143abd10
commit
971fa312ec
@ -1116,7 +1116,8 @@ var TelemetrySendImpl = {
|
||||
|
||||
const url = this._buildSubmissionURL(ping);
|
||||
|
||||
let request = new ServiceRequest();
|
||||
// Don't send cookies with these requests.
|
||||
let request = new ServiceRequest({mozAnon: true});
|
||||
request.mozBackgroundRequest = true;
|
||||
request.timeout = Policy.pingSubmissionTimeout();
|
||||
|
||||
|
@ -22,6 +22,8 @@ ChromeUtils.import("resource://gre/modules/TelemetryStopwatch.jsm", this);
|
||||
ChromeUtils.defineModuleGetter(this, "TelemetryHealthPing",
|
||||
"resource://gre/modules/TelemetryHealthPing.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(Services, "cookies", "@mozilla.org/cookieService;1", "nsICookieService");
|
||||
|
||||
const MS_IN_A_MINUTE = 60 * 1000;
|
||||
|
||||
function countPingTypes(pings) {
|
||||
@ -530,6 +532,22 @@ add_task(async function test_sendCheckOverride() {
|
||||
Services.prefs.clearUserPref(TelemetryUtils.Preferences.OverrideOfficialCheck);
|
||||
});
|
||||
|
||||
add_task(async function testCookies() {
|
||||
const TEST_TYPE = "test-cookies";
|
||||
|
||||
await TelemetrySend.reset();
|
||||
PingServer.clearRequests();
|
||||
|
||||
let uri = Services.io.newURI("http://localhost:" + PingServer.port);
|
||||
Services.cookies.setCookieString(uri, null, "cookie-time=yes", null);
|
||||
|
||||
const id = await TelemetryController.submitExternalPing(TEST_TYPE, {});
|
||||
let request = await PingServer.promiseNextRequest();
|
||||
let ping = decodeRequestPayload(request);
|
||||
Assert.equal(id, ping.id, "We're testing the right ping's request, right?");
|
||||
Assert.equal(false, request.hasHeader("Cookie"), "Request should not have Cookie header");
|
||||
});
|
||||
|
||||
add_task(async function test_measurePingsSize() {
|
||||
const TEST_TYPE = "test-measure-ping-size";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user