Backed out changeset afef23568473 (bug 1843606) for causing failures at browser_all_files_referenced.js. CLOSED TREE

This commit is contained in:
Butkovits Atila 2023-07-19 19:00:08 +03:00
Родитель a8ff79365f
Коммит e0205221f1
3 изменённых файлов: 0 добавлений и 111 удалений

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

@ -18,10 +18,6 @@ XPCSHELL_TESTS_MANIFESTS += [
"unit_ipc/xpcshell.ini",
]
EXTRA_JS_MODULES["netwerk-perf"] += [
"perf/NetworkThrottlingUtils.sys.mjs",
]
TESTING_JS_MODULES += [
"browser/cookie_filtering_helper.sys.mjs",
"browser/early_hint_preload_test_helper.sys.mjs",

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

@ -1,106 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
NetworkObserver:
"resource://devtools/shared/network-observer/NetworkObserver.sys.mjs",
});
/**
* The NetworkThrottler uses the dev tools NetworkObserver to provide api to throttle all network activity.
*
* This can be used to fix network conditions in browsertime pageload tests, e.g.
*
* const script = `
* var {NetworkThrottler} = ChromeUtils.importESModule("resource://gre/modules/netwerk-perf/NetworkThrottlingUtils.sys.mjs");
*
* let networkThrottler = new NetworkThrottler();
*
* let throttleData = {
* latencyMean: 200,
* latencyMax: 200,
* downloadBPSMean: 125000,
* downloadBPSMax: 125000,
* uploadBPSMean: 125000,
* uploadBPSMax: 125000
* };
* networkThrottler.start(throttleData);
*
* ... run throttled tests ...
*
* networkThrottler.stop();
* `;
* commands.js.runPrivileged(script);
*
*/
// A minimal struct for onNetworkEvent handling
class NetworkEventRecord {
addRequestPostData() {}
addResponseStart() {}
addSecurityInfo() {}
addEventTimings() {}
addResponseCache() {}
addResponseContent() {}
addServerTimings() {}
}
export class NetworkThrottler {
#devtoolsNetworkObserver;
#throttling;
constructor() {
this.#throttling = false;
}
destroy() {
this.stop();
}
start(throttleData) {
if (this.#throttling) {
console.error("NetworkThrottler already started");
return;
}
this.#devtoolsNetworkObserver = new lazy.NetworkObserver({
ignoreChannelFunction: this.#ignoreChannelFunction,
onNetworkEvent: this.#onNetworkEvent,
});
this.#devtoolsNetworkObserver.setThrottleData(throttleData);
this.#throttling = true;
}
stop() {
if (!this.#throttling) {
return;
}
this.#devtoolsNetworkObserver.destroy();
this.#devtoolsNetworkObserver = null;
this.#throttling = false;
}
#ignoreChannelFunction = channel => {
// Ignore chrome-privileged or DevTools-initiated requests
if (
channel.loadInfo?.loadingDocument === null &&
(channel.loadInfo.loadingPrincipal ===
Services.scriptSecurityManager.getSystemPrincipal() ||
channel.loadInfo.isInDevToolsContext)
) {
return true;
}
return false;
};
#onNetworkEvent = (networkEvent, channel) => {
return new NetworkEventRecord(networkEvent, channel, this);
};
}

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

@ -852,7 +852,6 @@
"resource://gre/modules/narrate/Narrator.jsm": "toolkit/components/narrate/Narrator.jsm",
"resource://gre/modules/narrate/VoiceSelect.jsm": "toolkit/components/narrate/VoiceSelect.jsm",
"resource://gre/modules/netwerk-dns/PublicSuffixList.jsm": "netwerk/dns/PublicSuffixList.jsm",
"resource://gre/modules/netwerk-perf/NetworkThrottlingUtils.jsm": "netwerk/test/perf/NetworkThrottlingUtils.jsm",
"resource://gre/modules/nsAsyncShutdown.jsm": "toolkit/components/asyncshutdown/nsAsyncShutdown.jsm",
"resource://gre/modules/nsCrashMonitor.jsm": "toolkit/components/crashmonitor/nsCrashMonitor.jsm",
"resource://gre/modules/nsFormAutoCompleteResult.jsm": "toolkit/components/satchel/nsFormAutoCompleteResult.jsm",