Skip to content

Commit 9894c07

Browse files
committed
Add page for setting up development profile, content based on https://wiki.mozilla.org/DevTools/Hacking#Configuring_your_dev_profile
1 parent dd76579 commit 9894c07

File tree

4 files changed

+83
-1
lines changed

4 files changed

+83
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ We abide by our [code of conduct](CODE_OF_CONDUCT.md), and expect all contributo
1111
## Working on the code and contributing
1212

1313
* [Building DevTools](./docs/building.md) will get you from zero to custom build of DevTools you can modify in your computer.
14-
<!--TODO: * creating a dev profile, recommended settings-->
14+
* [Setting up a development profile](./docs/building-development-profile.md) shows how to configure Firefox with the best settings for developing and debugging DevTools.
1515
<!--TODO: * Finding bugs to work on-->
1616
<!--TODO: * Getting your code into DevTools' repository (AKA creating and sending patches) -->
1717

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
---
3+
4+
# Setting up a development profile
5+
6+
You can have various [Firefox profiles](https://developer.mozilla.org/en-US/Firefox/Multiple_profiles) (think of something like "user accounts"), each one with different settings, addons, appearance, etc.
7+
8+
This page will guide you through configuring a new profile to enable development features such as additional logging, dumping of network packets, remote debugging, etc. which will help when working in DevTools.
9+
10+
Many of these changes are achieved by modifying preferences in `about:config`, an special page you can access by entering that in Firefox's URL bar. The first time, it will show you a warning page. Click through and then you can start searching for preferences to modify.
11+
12+
Here's [a support article](https://support.mozilla.org/t5/Manage-preferences-and-add-ons/Configuration-Editor-for-Firefox/ta-p/35030) if you need help.
13+
14+
## Create a permanent profile
15+
16+
We were using a temporary profile in the previous step, [building DevTools](./building.md). The contents of this profile are deleted each time the browser is closed, which means any preferences we set will not persist.
17+
18+
The solution is creating a new profile:
19+
20+
```
21+
./mach -P development
22+
```
23+
24+
If this profile doesn't exist yet (quite likely), a window will open offering you options to create a new profile, and asking you which name you want to use. Create a new one, and name it `development`. Then start Firefox by clicking on `Start Nightly`.
25+
26+
Next time you start Firefox with `./mach -P development`, the new profile will be automatically used, and settings will persist between browser launches.
27+
28+
## Enable additional logging
29+
30+
You can change the value of these preferences by going to `about:config`:
31+
32+
| Preference name | Value | Comments |
33+
| --------------- | --------------- | -------- |
34+
| `browser.dom.window.dump.enabled` | `true` | Adds global `dump` function to log strings to `stdout` |
35+
| `devtools.debugger.log` (*) | `true` | Dump packets sent over remote debugging protocol to `stdout`.<br /><br />The [remote protocol inspector add-on](https://github.com/firebug/rdp-inspector/wiki) might be useful too. |
36+
| `devtools.dump.emit` (*) | `true` | Log event notifications from the EventEmitter class<br />(found at `devtools/shared/event-emitter.js`). |
37+
38+
Preferences marked with a (`*`) also require `browser.dom.window.dump.enabled` in order to work. You might not want to enable *all* of those all the time, as they can cause the output to be way too verbose, but they might be useful if you're working on a server actor, for example<!--TODO link to actors doc-->.
39+
40+
Restart the browser to apply configuration changes.
41+
42+
## Enable remote debugging and the Browser Toolbox
43+
44+
These settings allow you to use the [browser toolbox](https://developer.mozilla.org/docs/Tools/Browser_Toolbox) to inspect the DevTools themselves, set breakpoints inside of DevTools code, and run the [Scratchpad](https://developer.mozilla.org/en-US/docs/Tools/Scratchpad) in the *Browser* environment.
45+
46+
Open DevTools, and click the "Toolbox Options" gear icon in the top right (the image underneath is outdated). <!--TODO update image-->
47+
48+
Make sure the following two options are checked:
49+
50+
- Enable browser chrome and add-on debugging toolboxes
51+
- Enable remote debugging
52+
53+
![Settings for developer tools - "Enable Chrome Debugging" and "Enable Remote Debugging"](../images/DevToolsDeveloperSettings.png)
54+
55+
In `about:config`, set `devtools.debugger.prompt-connection` to `false`.
56+
57+
This will get rid of the prompt displayed every time you open the browser toolbox.
58+
59+
## Enable DevTools assertions
60+
61+
When assertions are enabled, assertion failures are fatal, log console warnings, and throw errors.
62+
63+
When assertions are not enabled, the `assert` function is a no-op.
64+
65+
It also enables the "debug" builds of certain third party libraries, such as React.
66+
67+
To enable assertions, add this to your `.mozconfig`:
68+
69+
```
70+
ac_add_options --enable-debug-js-modules
71+
```
72+
73+
And assert your own invariants like this:
74+
75+
```
76+
const { assert } = require("devtools/shared/DevToolsUtils");
77+
// ...
78+
assert(1 + 1 === 2, "I really hope this is true...");
79+
```
80+
81+

docs/building.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,4 @@ While not as fast as the average "save file and reload the website" *web develop
136136

137137
And certainly faster than building each time, even with artifact builds.
138138

139+
Next up: [setting up a development profile](./building-development-profile.md).
137 KB
Loading

0 commit comments

Comments
 (0)