Changes

Jump to: navigation, search

WebExtensions/Contribution Onramp

914 bytes added, 21:48, 4 June 2020
Update section on setting up the development environment. Add more explicit instructions on submitting a patch.
== Setting Up Developer Environment ==
* Now, you need to set up your development environment by [https://developerfirefox-source-docs.mozilla.org/encontributing/contribution_quickref.html#clone-the-USsources cloning the source] with mercurial or [https://github.com/docsglandium/Mozillagit-cinnabar/Developer_guidewiki/Build_InstructionsMozilla:-A-git-workflow-for-Gecko-development with Git].* Then you need to install dependencies with <code>mach bootstrap</Simple_Firefox_build code> for building Firefox]. There are two ways to do this:
** [recommended] Build Firefox using [https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Artifact_builds Firefox Artifact builds]. If the issue only requires changes to privileged JavaScript code, we recommend you use this method. Artifact builds saves time because it downloads a pre-built version of Firefox sources and applies your local changes on it, instead of rebuilding all of the C++ and Rust pieces from scratch.
*** Build To build Firefox for Android , see the [https://developerfirefox-source-docs.mozilla.org/en-USmobile/docsandroid/Mozillageckoview/Developer_guidecontributor/Build_Instructions/Simple_Firefox_for_Android_build requires some additional setup stepsgeckoview-quick-start.html GeckoView Contributor guide]. For a faster local development experience, we recommend to use the Artifact builds and the Android x86 target (which is especially useful to run the tests locally).** [default] Build Firefox from scratch, by running <code>mach build</code> without [https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Simple_Firefox_build Build Firefox from scratchConfiguring_Build_Options .mozconfig]. Note: doing this can take some time. After the initial build, you can build Firefox using the “mach build” command.
* Next, use [https://searchfox.org Searchfox] to find the code associated with your bug.
* Before making any changes, use <code>mach test [path to extension test]</code> to verify that you are able to run unit tests. Being able to run existing tests (and modified or new tests) is necessary, to see that your change works as expected.
==== WebExtensions APIs ====
For an overview of how to submit a patch, please see [https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/How_to_Submit_a_Patch this page on MDN].
* Create a commit with a meaningful commit message, for example <code>Bug [bug ID here] - [short description of patch here] r=[reviewer name here]</code>.
** Use <code>hg com --amend</code> or <code>git commit --amend</code> to modify the last commit if you want to change the commit title or content.
** If you want to combine multiple commits into one:
*** With mercurial, use <code>hg histedit</code> or <code>hg rebase</code>. For more info, see [https://book.mercurial-scm.org/read/changing-history.html Mercurial - Changing history]
*** With git, use <code>git rebase -i</code>. For more info, see [https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History Git - Rewriting History].
* When you are ready to have your patch reviewed, submit your patch to [https://moz-conduit.readthedocs.io/en/latest/phabricator-user.html Phabricator]:
** First, [https://moz-conduit.readthedocs.io/en/latest/phabricator-user.html#creating-an-account create an account] and install the [https://phabricator.services.mozillagithub.com/bookmozilla-conduit/phabricatorreview/articleblob/arcanist_quick_startmaster/ arc README.md#installation moz-phab tool].*** If your contribution consists of multiple separate patches, then Then [https://github.com/mozilla-conduit/review#readme moz-phab] may be an easier way to submit all patches at once. <br>If you [https:/blob/github.com/glandium/git-cinnabarmaster/wiki/Mozilla:-A-git-workflow-for-Gecko-development use git], then the standalone [https://githubREADME.com/mystor/phlay phlay tool] can also be used instead. ** Then, use [https://md#execution run moz-conduit.readthedocs.io/en/latest/arcanist-user.html these instructionsphab] to submit the upload your commit. Each commit will become a separe patch. Choose your mentor as the reviewer, so combine them into one if needed.** Note that you may go through a few iterations of changes and review before your code is ready to go. * If you need to make a change to a patch that has already been submitted to Phabricator, make sure you update the existing revision so the reviewers can check the interdiff and history of changes. <code>moz-phab</code> will automatically modify your commit [https://github.com/mozilla-conduit/review/blob/master/README.md#associating-a-commit-to-an-existing-phabricator-revision to add the relevant link]. * When working on unrelated changes at the same time, it is useful to work on them into separate hg bookmarks (or entire separate mozilla-central clones if you are not yet feeling confident enough with how the hg bookmarks works)or git branches.
* When the patch is approved, edit your Phabricator revision and add the “Check-in needed” tag.
* QA will verify your patch after it lands, unless your mentor has added a “qa-not-needed” keyword.
* Once your patch is accepted, you can expect to see your code in an upcoming version of Firefox!
44
edits

Navigation menu