DevTools/Hacking: Difference between revisions

no edit summary
No edit summary
Line 12: Line 12:


For your first build, running <code>./mach build</code> should do the trick after you get the source code.  If you are going to be building a lot, you may want to set up your [https://developer.mozilla.org/en-US/docs/Configuring_Build_Options .mozconfig file].
For your first build, running <code>./mach build</code> should do the trick after you get the source code.  If you are going to be building a lot, you may want to set up your [https://developer.mozilla.org/en-US/docs/Configuring_Build_Options .mozconfig file].
= Incremental Builds =
Once you've already built Firefox once, and you just want to incrementally update your build with your latest devtools changes, you can run:
  $ ./mach build toolkit/devtools browser
Which is much faster and should only take a few seconds.
= Running your build =


== First Run ==
== First Run ==
Line 35: Line 25:
Open DevTools, and click the "Toolbox Options" gear in the top left.  Make sure the following two options are checked: '''Enable Chrome Debugging''' and '''Enable Remote Debugging'''.  These settings allow you to use the [https://developer.mozilla.org/en-US/docs/Debugging_JavaScript#JavaScript_Debugger browser debugger] to set breakpoints inside of the DevTools code, and let you run the [https://developer.mozilla.org/en-US/docs/Tools/Scratchpad Scratchpad] in the ''Browser'' environment.   
Open DevTools, and click the "Toolbox Options" gear in the top left.  Make sure the following two options are checked: '''Enable Chrome Debugging''' and '''Enable Remote Debugging'''.  These settings allow you to use the [https://developer.mozilla.org/en-US/docs/Debugging_JavaScript#JavaScript_Debugger browser debugger] to set breakpoints inside of the DevTools code, and let you run the [https://developer.mozilla.org/en-US/docs/Tools/Scratchpad Scratchpad] in the ''Browser'' environment.   


[[Image:DevToolsDeveloperSettings.png|center|600px|Settings for developer tools - "Enable Chrome Debugging" and "Enable Remote Debugging"]]  
[[Image:DevToolsDeveloperSettings.png|center|600px|Settings for developer tools - "Enable Chrome Debugging" and "Enable Remote Debugging"]]


Depending on what you are working on, you may want to make some more changes to your profile.  If you type  '''about:config''' in the URL bar, click through the warning page, and search for '''devtools''' you can see some of them.
= Development workflow =


  # This setting prints all packets sent over the remote debugging protocol to stdout:
== Incremental Builds ==
  '''devtools.debugger.log''' = true


Restart the browser to apply any configuration changes.
Once you've already built Firefox once, and you just want to incrementally update your build with your latest devtools changes, you can run:


== Development workflow ==
  $ ./mach build toolkit/devtools browser


As you make changes to the code, you can run the following commands to see your changes (you may want to store these in a script for reuse).
Which is much faster than your first build or clobber builds and should only take a few seconds. You can run your build the same way you did before:


  $ ./mach build toolkit/devtools browser
   $ ./mach run -p development
   $ ./mach run -p development
Note that whenever you pull the latest changes from `fx-team` into your local repository, you may need to "clobber". A "clobber" is similar to "make clean". You'll know you need to clobber when you get a big error message telling you to do a clobber build after you tried to do an incremental build. To do a clobber build, enter these commands:
  $ ./mach clobber
  $ ./mach build
== Enabling DevTools Logging ==
Depending on what you are working on, you may want to make some changes to your profile to enable more logging. If you type  '''about:config''' in the URL bar, click through the warning page, and search for '''devtools''' you can see some of them.
  # Add the global "dump" function to all windows which outputs strings to stdout.
  '''browser.dom.window.dump.enabled''' = true
  # Dumps all packets sent over the remote debugging protocol to stdout (requires browser.dom.window.dump.enabled):
  '''devtools.debugger.log''' = true
  # Log every event notification from the EventEmitter class (toolkit/devtools/event-emitter.js) (requires browser.dom.window.dump.enabled)
  '''devtools.dump.emit''' = true
Restart the browser to apply configuration changes.


= Making and Submitting a Patch =
= Making and Submitting a Patch =
Confirmed users
125

edits