mirror of
https://github.com/ManchildProductions/UXP-Fixed.git
synced 2026-05-27 15:38:33 +00:00
c5c9445e3a
Potential attack: session supercookie. [Moz Notes](https://bugzilla.mozilla.org/show_bug.cgi?id=1334776#c5): "The problem is that for unknown header names we store the first one we see and then later we case-insensitively match against that name *globally*. That means you can track if a user agent has already seen a certain header name used (by using a different casing and observing whether it gets normalized). This would allow you to see if a user has used a sensitive service that uses custom header names, or allows you to track a user across sites, by teaching the browser about a certain header case once and then observing if different casings get normalized to that. What we should do instead is only store the casing for a header name for each header list and not globally. That way it only leaks where it's expected (and necessary) to leak." [Moz fix note](https://bugzilla.mozilla.org/show_bug.cgi?id=1334776#c8): "nsHttpAtom now holds the old nsHttpAtom and a string that is case sensitive (only for not standard headers). So nsHttpAtom holds a pointer to a header name. (header names are store on a static structure). This is how it used to be. I left that part the same but added a nsCString which holds a string that was used to resoled the header name. So when we parse headers we call ResolveHeader with a char*. If it is a new header name the char* will be stored in a HttpHeapAtom, nsHttpAtom::_val will point to HttpHeapAtom::value and the same strings will be stored in mLocalCaseSensitiveHeader. For the first resolve request they will be the same but for the following maybe not. At the end this nsHttpAtom will be stored in nsHttpHeaderArray. For all operation we will used the old char* except when we are returning it to a script using VisitHeaders."
62 lines
2.1 KiB
JavaScript
62 lines
2.1 KiB
JavaScript
/* Any copyright is dedicated to the Public Domain.
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
"use strict";
|
|
|
|
/**
|
|
* Tests if timing intervals are divided againts seconds when appropriate.
|
|
*/
|
|
|
|
add_task(function* () {
|
|
let { tab, monitor } = yield initNetMonitor(CUSTOM_GET_URL);
|
|
info("Starting test... ");
|
|
|
|
let { $all, NetMonitorView } = monitor.panelWin;
|
|
let { RequestsMenu } = NetMonitorView;
|
|
|
|
RequestsMenu.lazyUpdate = false;
|
|
|
|
let wait = waitForNetworkEvents(monitor, 2);
|
|
// Timeout needed for having enough divisions on the time scale.
|
|
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
|
|
content.wrappedJSObject.performRequests(2, null, 3000);
|
|
});
|
|
yield wait;
|
|
|
|
let milDivs = $all(".requests-menu-timings-division[division-scale=millisecond]");
|
|
let secDivs = $all(".requests-menu-timings-division[division-scale=second]");
|
|
let minDivs = $all(".requests-menu-timings-division[division-scale=minute]");
|
|
|
|
info("Number of millisecond divisions: " + milDivs.length);
|
|
info("Number of second divisions: " + secDivs.length);
|
|
info("Number of minute divisions: " + minDivs.length);
|
|
|
|
for (let div of milDivs) {
|
|
info("Millisecond division: " + div.getAttribute("value"));
|
|
}
|
|
for (let div of secDivs) {
|
|
info("Second division: " + div.getAttribute("value"));
|
|
}
|
|
for (let div of minDivs) {
|
|
info("Minute division: " + div.getAttribute("value"));
|
|
}
|
|
|
|
is(RequestsMenu.itemCount, 2,
|
|
"There should be only two requests made.");
|
|
|
|
let firstRequest = RequestsMenu.getItemAtIndex(0);
|
|
let lastRequest = RequestsMenu.getItemAtIndex(1);
|
|
|
|
info("First request happened at: " +
|
|
firstRequest.attachment.responseHeaders.headers.find(e => e.name == "date").value);
|
|
info("Last request happened at: " +
|
|
lastRequest.attachment.responseHeaders.headers.find(e => e.name == "date").value);
|
|
|
|
ok(secDivs.length,
|
|
"There should be at least one division on the seconds time scale.");
|
|
ok(secDivs[0].getAttribute("value").match(/\d+\.\d{2}\s\w+/),
|
|
"The division on the seconds time scale looks legit.");
|
|
|
|
return teardown(monitor);
|
|
});
|