Bug 1203786 - test_memoryReporters.xul should ignore namespaces. r=njn

--HG--
extra : transplant_source : 8%B4%E0f%1A%B1%94%0Ce%15%FCopt%127g%ACK%FB
This commit is contained in:
J. Ryan Stinnett 2015-09-10 19:04:04 -05:00
Родитель 73389bf1f4
Коммит 21ea7df326
1 изменённых файлов: 10 добавлений и 3 удалений

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

@ -39,6 +39,11 @@
const COUNT_CUMULATIVE = Ci.nsIMemoryReporter.UNITS_COUNT_CUMULATIVE;
const PERCENTAGE = Ci.nsIMemoryReporter.UNITS_PERCENTAGE;
// Use backslashes instead of forward slashes due to memory reporting's hacky
// handling of URLs.
const XUL_NS =
"http:\\\\www.mozilla.org\\keymaster\\gatekeeper\\there.is.only.xul";
let vsizeAmounts = [];
let residentAmounts = [];
let heapAllocatedAmounts = [];
@ -119,13 +124,16 @@
function handleReportAnonymized(aProcess, aPath, aKind, aUnits, aAmount,
aDescription)
{
// Path might include an xmlns using http, which is safe to ignore.
let reducedPath = aPath.replace(XUL_NS, "");
// Shouldn't get http: or https: in any paths.
if (aPath.includes('http:')) {
if (reducedPath.includes('http:')) {
present.httpWhenAnonymized = aPath;
}
// file: URLs should have their path anonymized.
if (aPath.search('file:..[^<]') !== -1) {
if (reducedPath.search('file:..[^<]') !== -1) {
present.unanonymizedFilePathWhenAnonymized = aPath;
}
}
@ -391,4 +399,3 @@
]]>
</script>
</window>