mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Bug 945973 (part 1) - Remove about:memory's is-a-sentence description check. r=mccr8.
--HG-- extra : rebase_source : bf47145a953a23b73fa1e7c441b695ffeceafbb8
This commit is contained in:
parent
51be634cd2
commit
51c80b126d
@ -422,8 +422,6 @@ function updateAboutMemoryFromReporters()
|
||||
|
||||
// Increment this if the JSON format changes.
|
||||
//
|
||||
// If/when this changes to 2, the beLenient() function and its use can be
|
||||
// removed.
|
||||
var gCurrentFileFormatVersion = 1;
|
||||
|
||||
/**
|
||||
@ -822,11 +820,6 @@ function appendAboutMemoryMain(aProcessReports, aHasMozMallocUsableSize)
|
||||
{
|
||||
let pcollsByProcess = {};
|
||||
|
||||
// This regexp matches sentences and sentence fragments, i.e. strings that
|
||||
// start with a capital letter and ends with a '.'. (The final sentence may
|
||||
// be in parentheses, so a ')' might appear after the '.'.)
|
||||
const gSentenceRegExp = /^[A-Z].*\.\)?$/m;
|
||||
|
||||
function handleReport(aProcess, aUnsafePath, aKind, aUnits, aAmount,
|
||||
aDescription, aPresence)
|
||||
{
|
||||
@ -834,33 +827,6 @@ function appendAboutMemoryMain(aProcessReports, aHasMozMallocUsableSize)
|
||||
assertInput(aKind === KIND_HEAP || aKind === KIND_NONHEAP,
|
||||
"bad explicit kind");
|
||||
assertInput(aUnits === UNITS_BYTES, "bad explicit units");
|
||||
assertInput(gSentenceRegExp.test(aDescription),
|
||||
"non-sentence explicit description");
|
||||
|
||||
} else {
|
||||
const kLenientPrefixes =
|
||||
['rss/', 'pss/', 'size/', 'swap/', 'compartments/', 'ghost-windows/'];
|
||||
let beLenient = function(aUnsafePath) {
|
||||
for (let i = 0; i < kLenientPrefixes.length; i++) {
|
||||
if (aUnsafePath.startsWith(kLenientPrefixes[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// In general, non-explicit reports should have a description that is a
|
||||
// complete sentence. However, we want to be able to read old saved
|
||||
// reports, so we are lenient in a couple of situations where we used to
|
||||
// allow non-sentence descriptions:
|
||||
// - smaps reports (which were removed in bug 912165);
|
||||
// - compartment and ghost-window reports (which had empty descriptions
|
||||
// prior to bug 911641).
|
||||
if (!beLenient(aUnsafePath)) {
|
||||
assertInput(gSentenceRegExp.test(aDescription),
|
||||
"non-sentence other description: " + aUnsafePath + ", " +
|
||||
aDescription);
|
||||
}
|
||||
}
|
||||
|
||||
assert(aPresence === undefined ||
|
||||
|
@ -140,12 +140,13 @@ interface nsIMemoryReporterCallback : nsISupports
|
||||
* regions of memory that have been explicitly allocated with an
|
||||
* OS-level allocation (e.g. mmap/VirtualAlloc/vm_allocate) or a
|
||||
* heap-level allocation (e.g. malloc/calloc/operator new). Reporters
|
||||
* in this tree must have kind HEAP or NONHEAP, units BYTES, and a
|
||||
* description that is a sentence (i.e. starts with a capital letter and
|
||||
* ends with a period, or similar).
|
||||
* in this tree must have kind HEAP or NONHEAP, units BYTES.
|
||||
*
|
||||
* - All other reports are unconstrained except that they must have a
|
||||
* description that is a sentence.
|
||||
* - All other reports are unconstrained.
|
||||
*
|
||||
* It is preferred, but not required, that report descriptions use complete
|
||||
* sentences (i.e. start with a capital letter and end with a period, or
|
||||
* similar).
|
||||
*/
|
||||
[scriptable, uuid(0884cd0f-5829-4381-979b-0f53904030ed)]
|
||||
interface nsIMemoryReporter : nsISupports
|
||||
|
Loading…
Reference in New Issue
Block a user