mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1238639 - HeapAnalysesWorker getCreationTime throws when given non-existant path;r=fitzgen
This commit is contained in:
parent
55ac9f732d
commit
1eaaa02678
@ -91,8 +91,10 @@ workerHelper.createTask(self, "takeCensusDiff", request => {
|
||||
* @see HeapAnalysesClient.prototype.getCreationTime
|
||||
*/
|
||||
workerHelper.createTask(self, "getCreationTime", snapshotFilePath => {
|
||||
let snapshot = snapshots[snapshotFilePath];
|
||||
return snapshot ? snapshot.creationTime : null;
|
||||
if (!snapshots[snapshotFilePath]) {
|
||||
throw new Error(`No known heap snapshot for '${snapshotFilePath}'`);
|
||||
}
|
||||
return snapshots[snapshotFilePath].creationTime;
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -32,12 +32,17 @@ add_task(function* () {
|
||||
yield client.readHeapSnapshot(snapshotFilePath);
|
||||
ok(true, "Should have read the heap snapshot");
|
||||
|
||||
let time = yield client.getCreationTime("/not/a/real/path", {
|
||||
breakdown: BREAKDOWN
|
||||
});
|
||||
equal(time, null, "getCreationTime returns `null` when snapshot does not exist");
|
||||
let threw = false;
|
||||
try {
|
||||
yield client.getCreationTime("/not/a/real/path", {
|
||||
breakdown: BREAKDOWN
|
||||
});
|
||||
} catch (_) {
|
||||
threw = true;
|
||||
}
|
||||
ok(threw, "getCreationTime should throw when snapshot does not exist");
|
||||
|
||||
time = yield client.getCreationTime(snapshotFilePath, {
|
||||
let time = yield client.getCreationTime(snapshotFilePath, {
|
||||
breakdown: BREAKDOWN
|
||||
});
|
||||
ok(time >= start, "creation time occurred after start");
|
||||
|
Loading…
Reference in New Issue
Block a user