Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add a custom network throttling to Firefox?

This is on topic for stackoverflow as it pertains to dev tools.

What I want to do is load a satellite internet profile to F12 Network throttling. Something like 500ms latency & max bandwidth of 25Mbit.

We have some debates as to whether or not our web application can tolerate this due to extensive use of require.js.

like image 464
Joshua Avatar asked Aug 19 '19 22:08

Joshua


People also ask

How do I enable Throttling in Firefox?

The toolbar includes a Throttling dropdown, which allows you to throttle your network speed to emulate various different network speed conditions. Choose an option from the menu, and it will persist across reloads.

How do I select network throttling profile?

Go to Settings > Throttling. Select Add a custom profile. Enter a Profile Name, Download speed, Upload speed and Latency. You can apply your new throttling profile from the Network Panel throttle options.


1 Answers

Based on my reading of the Firefox code, the throttling profiles are hardcoded, and not configurable. Bug 1471539 (currently open) requests to make them configurable.

In the old times it was possible to edit browser/omni.jar (it's a zip file) and have the changes picked up after a restart. If that's still the case, you could make a separate install of Firefox and edit the hardcoded values (chrome\devtools\modules\devtools\client\shared\components\throttling\profiles.js inside the omni.ja)

With appropriate experience, you could extract the code used to implement throttling and run it in the Browser console (in "chrome context"). (At first I suspected the network.http.throttle preferences were responsible for this, but that's a completely separate thing related to throttling in background tabs.)

The most sure-fire option is to make your own build of Firefox, but that requires setting up and a non-trivial amount of system resources.

P.S. How large are your files? If the omni.jar trick doesn't work, it might be easier to select an existing profile and extrapolate.

PPS. You probably have your reasons not to use WebPack or another bundler, but I have to mention it.

like image 86
Nickolay Avatar answered Sep 29 '22 07:09

Nickolay