Bug 1470280 - Part 1: Make browser_preferences_usage.js less brittle. r=kmag

browser_preferences_usage.js hardcodes a max value of 15 accesses which doesn't scale well as we increase the number of processes. Instead we'll base the max on a multiplier of the default process count which should avoid bustage in the future but still catch egregious accesses.

--HG--
extra : rebase_source : 5484be4833dfc220126f893c722c793e7be93ed1
extra : source : 60699c2387f6e51398c345996a97551a867bd2d7
This commit is contained in:
Eric Rahm 2018-10-05 14:28:58 -07:00
Родитель 720e5ce650
Коммит 7329799838
1 изменённых файлов: 6 добавлений и 5 удалений

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

@ -1,6 +1,8 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
const DEFAULT_PROCESS_COUNT = Services.prefs.getDefaultBranch(null).getIntPref("dom.ipc.processCount");
/**
* A test that checks whether any preference getter from the given list
* of stats was called more often than the max parameter.
@ -120,7 +122,10 @@ add_task(async function startup() {
// This opens 10 tabs and checks pref getters.
add_task(async function open_10_tabs() {
let max = 15;
// This is somewhat arbitrary. When we had a default of 4 content processes
// the value was 15. We need to scale it as we increase the number of
// content processes so we approximate with 4 * process_count.
const max = 4 * DEFAULT_PROCESS_COUNT;
let whitelist = {
"layout.css.dpi": {
@ -146,10 +151,6 @@ add_task(async function open_10_tabs() {
min: 10,
max: 18,
},
"dom.ipc.processCount": {
min: 10,
max: 15,
},
"browser.startup.record": {
max: 20,
},