44
edits
(“Check-in Needed” is sunset in favor of Lando) |
(Update links (mostly broken MDN links); mention Android-specific xpcshell tests) |
||
Line 1: | Line 1: | ||
If this is your first contribution to the Firefox codebase, welcome! It can be scary to get started contributing to a large and complex codebase, but we’ve prepared some tips to help you fix a good-first-bug and land a patch in Firefox. | If this is your first contribution to the Firefox codebase, welcome! It can be scary to get started contributing to a large and complex codebase, but we’ve prepared some tips to help you fix a good-first-bug and land a patch in Firefox. | ||
If we haven’t addressed your question in this document, please ask us by leaving a comment in the bug or by joining us on chat.mozilla.org in the #addons room (see [[Matrix]]). For a general overview of how to contribute to Firefox, please [https:// | If we haven’t addressed your question in this document, please ask us by leaving a comment in the bug or by joining us on chat.mozilla.org in the #addons room (see [[Matrix]]). For a general overview of how to contribute to Firefox, please [https://firefox-source-docs.mozilla.org/contributing/contributing_to_mozilla.html go here]. | ||
== General Tips == | == General Tips == | ||
Line 37: | Line 37: | ||
== Testing == | == Testing == | ||
In order to land code in Firefox, you will need to create tests for your patches. For an overview of the different test systems Firefox uses, please see this [https://developer.mozilla.org/en-US/docs/Mozilla/QA/Automated_testing overview of automated testing]. In the WebExtension API code, most tests are either [https:// | In order to land code in Firefox, you will need to create tests for your patches. For an overview of the different test systems Firefox uses, please see this [https://web.archive.org/web/20210308052053/https://developer.mozilla.org/en-US/docs/Mozilla/QA/Automated_testing overview of automated testing] (needs update - [https://bugzilla.mozilla.org/show_bug.cgi?id=1736870 bug 1736870]). In the WebExtension API code, most tests are either [https://firefox-source-docs.mozilla.org/testing/xpcshell/index.html xpcshell tests] or [https://firefox-source-docs.mozilla.org/testing/mochitest-plain/index.html (browser-chrome) mochitests]. Xpcshell tests are preferred because of the lower overhead. Browser tests need to be written when a test interfaces with browser UI, such as tabs or context menus. | ||
The easiest way to get started with tests is to look at existing tests: | The easiest way to get started with tests is to look at existing tests: | ||
Line 43: | Line 43: | ||
** toolkit/components/extensions/test/xpcshell/ ([https://searchfox.org/mozilla-central/source/toolkit/components/extensions/test/xpcshell Searchfox link]) | ** toolkit/components/extensions/test/xpcshell/ ([https://searchfox.org/mozilla-central/source/toolkit/components/extensions/test/xpcshell Searchfox link]) | ||
** browser/components/extensions/test/xpcshell/ ([https://searchfox.org/mozilla-central/source/browser/components/extensions/test/xpcshell Searchfox link]) | ** browser/components/extensions/test/xpcshell/ ([https://searchfox.org/mozilla-central/source/browser/components/extensions/test/xpcshell Searchfox link]) | ||
** mobile/android/components/extensions/test/xpcshell ([https://searchfox.org/mozilla-central/source/mobile/android/components/extensions/test/xpcshell Searchfox link]) | |||
* Browser-chrome tests: | * Browser-chrome tests: | ||
Line 80: | Line 81: | ||
ExtensionTestUtils.loadExtension allows you to quickly generate a test extension, and its input parameters are documented at: | ExtensionTestUtils.loadExtension allows you to quickly generate a test extension, and its input parameters are documented at: | ||
https://searchfox.org/mozilla-central/rev/ | https://searchfox.org/mozilla-central/rev/5f88c1d6977e03e22d3420d0cdf8ad0113c2eb31/toolkit/components/extensions/ExtensionTestCommon.jsm#387-411 | ||
Another common action in tests is to load a web page or extension page. | Another common action in tests is to load a web page or extension page. | ||
Line 91: | Line 92: | ||
== Submitting a Patch == | == Submitting a Patch == | ||
For an overview of how to submit a patch, please see [https:// | For an overview of how to submit a patch, please see [https://firefox-source-docs.mozilla.org/contributing/how_to_submit_a_patch.html How to submit a patch]. In short: | ||
* 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>. | * 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>. |
edits