blob: 10ab9f5bc34b0733aa11937b3d748afa2a2dadd7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
const { ContentTaskUtils } = ChromeUtils.importESModule(
"resource://testing-common/ContentTaskUtils.sys.mjs"
);
add_setup(
/* on Android FOG is set up through head.js */
{ skip_if: () => !runningInParent || AppConstants.platform == "android" },
function test_setup() {
// Give FOG a temp profile to init within.
do_get_profile();
// We need to initialize it once, otherwise operations will be stuck in the pre-init queue.
Services.fog.initializeFOG();
}
);
// Keep in sync with ipc.rs.
// "Why no -1?" Because the limit's 100k. The -1 is because of atomic ops.
const FOG_IPC_PAYLOAD_ACCESS_LIMIT = 100000;
add_task({ skip_if: () => runningInParent }, async function run_child_stuff() {
for (let i = 0; i < FOG_IPC_PAYLOAD_ACCESS_LIMIT + 1; i++) {
Glean.testOnly.badCode.add(1);
}
});
add_task(
{ skip_if: () => !runningInParent },
async function test_fog_ipc_limit() {
await run_test_in_child("test_FOGIPCLimit.js");
await ContentTaskUtils.waitForCondition(() => {
return !!Glean.testOnly.badCode.testGetValue();
}, "Waiting for IPC.");
// The child exceeded the number of accesses to trigger an IPC flush.
Assert.greater(
Glean.testOnly.badCode.testGetValue(),
FOG_IPC_PAYLOAD_ACCESS_LIMIT
);
}
);
|