Bug 1353168 - Add a crash annotation to distinguish between web, file and extension content processes; r=bsmedberg

This adds the RemoteType annotation to a content crash report so that we can
distinguish between content processes that crashed while running remote, local
or extension code. The annotation is passed along the others to Socorro by the
crashreporter and is also whitelisted for inclusion in the crash ping.

MozReview-Commit-ID: 4avo0IWfMGf

--HG--
extra : rebase_source : 8d03f7e166b5762a5ce7cab13c2101302b4f1d2f
This commit is contained in:
Gabriele Svelto 2017-06-01 11:16:11 +02:00
Родитель 2d70c955cc
Коммит 43c10532d4
5 изменённых файлов: 26 добавлений и 0 удалений

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

@ -1505,6 +1505,8 @@ ContentChild::RecvSetProcessSandbox(const MaybeFileDesc& aBroker)
CrashReporter::AnnotateCrashReport(
NS_LITERAL_CSTRING("ContentSandboxCapabilities"), flagsString);
#endif /* XP_LINUX && !OS_ANDROID */
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("RemoteType"),
NS_ConvertUTF16toUTF8(GetRemoteType()));
#endif /* MOZ_CRASHREPORTER */
#endif /* MOZ_CONTENT_SANDBOX */

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

@ -230,6 +230,7 @@ this.CrashManager.prototype = Object.freeze({
"ProductID",
"ProductName",
"ReleaseChannel",
"RemoteType",
"SecondsSinceLastCrash",
"ShutdownProgress",
"StartupCrash",

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

@ -482,8 +482,10 @@ add_task(async function test_child_process_crash_ping() {
// Add a child-process crash for each allowed process type.
for (let p of EXPECTED_PROCESSES) {
// Generate a ping.
const remoteType = (p === m.PROCESS_TYPE_CONTENT) ? "web" : undefined;
let id = await m.createDummyDump();
await m.addCrash(p, m.CRASH_TYPE_CRASH, id, DUMMY_DATE, {
RemoteType: remoteType,
StackTraces: stackTraces,
MinidumpSha256Hash: sha256Hash,
ThisShouldNot: "end-up-in-the-ping"
@ -505,6 +507,8 @@ add_task(async function test_child_process_crash_ping() {
Assert.equal(found.payload.metadata.ThisShouldNot, undefined,
"Non-whitelisted fields should be filtered out");
Assert.equal(found.payload.metadata.RemoteType, remoteType,
"RemoteType should be whitelisted for content crashes");
}
// Check that we don't generate a crash ping for invalid/unexpected process

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

@ -56,6 +56,7 @@ Structure:
IsGarbageCollecting: 1, // Optional, present only if set to 1
MozCrashReason: <reason>, // Optional, contains the string passed to MOZ_CRASH()
OOMAllocationSize: <size>, // Size of the allocation that caused an OOM
RemoteType: <type>, // Optional, type of content process, see below for a list of types
SecondsSinceLastCrash: <duration>, // Seconds elapsed since the last crash occurred
SystemMemoryUsePercentage: <percentage>, // Windows-only, percent of memory in use
TelemetrySessionId: <id>, // Active telemetry session ID when the crash was recorded
@ -92,6 +93,23 @@ are sent only for the ones below:
| gpu | GPU process |
+---------------+---------------------------------------------------+
Remote Process Types
--------------------
The optional ``remoteType`` field contains the type of the content process that
crashed. As such it is present only if ``processType`` contains the ``content``
value. The following content process types are currently defined:
+-----------+--------------------------------------------------------+
| Type | Description |
+===========+========================================================+
| web | The content process was running code from a web page |
+-----------+--------------------------------------------------------+
| file | The content process was running code from a local file |
+-----------+--------------------------------------------------------+
| extension | The content process was running code from an extension |
+-----------+--------------------------------------------------------+
Stack Traces
------------

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

@ -137,6 +137,7 @@ CreateMetadataNode(StringTable& strings)
"ProductID",
"ProductName",
"ReleaseChannel",
"RemoteType",
"SecondsSinceLastCrash",
"StartupCrash",
"SystemMemoryUsePercentage",