mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-18 15:55:36 +00:00
Bug 1593728 Part 1: [devtools] Rename parameter in a test to avoid using the async keyword. r=perftest-reviewers,nchevobbe,sparky
This is just cleanup to avoid the "async" keyword as an identifier, plus using const where appropriate. Differential Revision: https://phabricator.services.mozilla.com/D93431
This commit is contained in:
parent
db1c8d8a34
commit
bc49180432
@ -8,16 +8,16 @@
|
||||
<script>
|
||||
// These query parameters are set in damp.js:customConsole and define the number
|
||||
// of console API calls we do in this test.
|
||||
let searchParams = new URLSearchParams(location.search);
|
||||
let sync = searchParams.get("sync");
|
||||
let stream = searchParams.get("stream");
|
||||
let async = searchParams.get("async");
|
||||
const searchParams = new URLSearchParams(location.search);
|
||||
const sync = searchParams.get("sync");
|
||||
const stream = searchParams.get("stream");
|
||||
const batch = searchParams.get("batch");
|
||||
|
||||
// We log complex objects:
|
||||
// * a complex js object (window)
|
||||
// * a DOM node (body)
|
||||
// * a large array
|
||||
let bigArray = Array.from({length: 10000}, (_, i) => i);
|
||||
const bigArray = Array.from({length: 10000}, (_, i) => i);
|
||||
|
||||
// Fill up the console with many logs synchronously during page load.
|
||||
for (let i = 0; i < sync; i++) {
|
||||
@ -31,20 +31,20 @@ function streamLogs() {
|
||||
if (n < stream) {
|
||||
requestAnimationFrame(streamLogs);
|
||||
} else {
|
||||
requestIdleCallback(asyncLogs);
|
||||
requestIdleCallback(batchLogs);
|
||||
}
|
||||
}
|
||||
requestIdleCallback(streamLogs);
|
||||
|
||||
// Finally, we log by small bulk asynchronously slightly more slowly thanks to idle callback
|
||||
// Finally, we batch log by small bulk asynchronously slightly more slowly thanks to idle callback
|
||||
let x = 0;
|
||||
function asyncLogs() {
|
||||
let asyncBulk = 10;
|
||||
for (let i = 0; i < asyncBulk; i++) {
|
||||
console.log("async log", x++, window, document.body, bigArray);
|
||||
function batchLogs() {
|
||||
const batchSize = 10;
|
||||
for (let i = 0; i < batchSize; i++) {
|
||||
console.log("batch log", x++, window, document.body, bigArray);
|
||||
}
|
||||
if (x < async) {
|
||||
requestIdleCallback(asyncLogs);
|
||||
if (x < batch) {
|
||||
requestIdleCallback(batchLogs);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -17,15 +17,15 @@ const TEST_URL = PAGES_BASE_URL + "custom/console/index.html";
|
||||
|
||||
module.exports = async function() {
|
||||
// These numbers controls the number of console api calls we do in the test
|
||||
let sync = 250,
|
||||
const sync = 250,
|
||||
stream = 250,
|
||||
async = 250;
|
||||
let params = `?sync=${sync}&stream=${stream}&async=${async}`;
|
||||
let url = TEST_URL + params;
|
||||
batch = 250;
|
||||
const params = `?sync=${sync}&stream=${stream}&batch=${batch}`;
|
||||
const url = TEST_URL + params;
|
||||
await testSetup(url, { disableCache: true });
|
||||
|
||||
let toolbox = await openToolboxAndLog("custom.webconsole", "webconsole");
|
||||
await reloadConsoleAndLog("custom", toolbox, sync + stream + async);
|
||||
const toolbox = await openToolboxAndLog("custom.webconsole", "webconsole");
|
||||
await reloadConsoleAndLog("custom", toolbox, sync + stream + batch);
|
||||
await closeToolboxAndLog("custom.webconsole", toolbox);
|
||||
|
||||
await testTeardown();
|
||||
|
Loading…
Reference in New Issue
Block a user