This page describes how to contribute changes to the WebKit source control repository. The WebKit project maintains several scripts to assist you. This page assumes you already know how to check out and build the code.
Below are the recommended steps. Later sections of this page explain each step in more detail.
- Choose or create a bug report to work on.
- Develop your changes.
- Make sure your changes meet the code style guidelines. The
check-webkit-stylescript may be of help.
- Run the layout tests using the
- Add any new files to your working directory.
- Prepare a change log entry. You may have to add entries to multiple ChangeLogs. The
prepare-ChangeLogscript will create stub entries for you. See the paragraph about ChangeLogs below.
- Create the patch using the
- Submit your patch for review to bugs.webkit.org.
- Make any changes recommended by the reviewer.
- Once reviewed, ask someone to land your patch or mark it for automated commit.
- Please watch for any regressions it may have caused (hopefully none)!
More detail about these steps is below.
The bugs.webkit.org database is the central point of communication for contributions to WebKit. Nearly every contribution corresponds to a bug report there. Note that WebKit uses bug reports to track all types of code changes and not just bug fixes. Choose a bug report to work on. You can also create a new report. Be sure to search the database before creating new reports to avoid duplication. After choosing a bug report, follow the WebKit bug life cycle guidelines for the report. For example, it is often good practice to comment in a report if you are working on that issue. If your change may be controversial, you may want to check in advance with the webkit-dev mailing list.
If you make substantive changes to a file, you may wish to add a copyright line for yourself or for the company on whose behalf you work. Below are sample copyright lines for an individual contributor and a company:
Copyright (C) 2011 John Smith (firstname.lastname@example.org)
Copyright (C) 2011 Company Inc. All rights reserved. In addition, make sure that any new source code and script files you introduce contain license text at the beginning of the file. If you are the author of a new file, preferred license text to include can be found here: WebKit/LICENSE. (The “Original Format” link at the bottom of the page contains text that can be cut and pasted more easily.) Simply replace the copyright line with your own information, for example as suggested above.
Patches must comply with the code style guidelines. Some older parts of the codebase do not follow these guidelines. If you are modifying such code, it is generally best to clean it up to comply with the current guidelines. An exception is legacy components, which should not be cleaned up. Your patch will be automatically checked for style compliance before uploading if you use
webkit-patch upload. You can check style manually by running the
Tools/Scripts/check-webkit-style script. Style will also be checked on each patch after it is uploaded by the WebKit Early Warning System.
Once you have made your changes, you need to run the regression tests, which is done via the
run-webkit-tests script. All tests must pass. Patches will not be landed in the tree if they break existing layout tests. For any feature that affects the layout engine, a new regression test must be constructed. If you provide a patch that fixes a bug, that patch should also include the addition of a regression test that would fail without the patch and succeed with the patch. If no regression test is provided, the reviewer will ask you to revise the patch, so you can save time by constructing the test up front and making sure it’s attached to the bug. If no layout test can be (or needs to be) constructed for the fix, you must explain why a new test isn’t necessary to the reviewer.
If your changes include adding new files (like new layout tests), use the
svn add command to mark these files for addition to the repository. If you do not do this, the new files will be missing from the patch file you generate below. You can learn more about Subversion commands like
svn add from the online book Version Control with Subversion and by using the
svn help command.
The easiest way to create a patch is to run
Tools/Scripts/webkit-patch upload. This will upload your current Subversion diff (or Git diff if you use git) to the issue tracking system and mark it as ready for review.
ChangeLogs are simple text files which provide historical documentation for all changes to the WebKit project. All patches require an entry to the ChangeLog. The
webkit-patch upload script will create a basic entry containing a list of all files that have been changed. The first line contains the date, your full name, and your email address. Use this to write up a brief summary of the changes you’ve made. Don’t worry about the “Reviewed by NOBODY (OOPS!)” line, the person landing your patch will fill this in. There is one ChangeLog per top-level directory, if you changed code and tests you will need to edit at least two ChangeLogs. The
prepare-ChangeLog script (automatically ran by
webkit-patch) will create a stub entries for you. You should edit these stubs to describe your change, including the full url to the bug (example entry, note that you can use
--bug flag). (You should set
CHANGE_LOG_NAME in your environment if you will be running this script frequently.) A typical change log entry before being submitted to Bugzilla looks like this:
2012-10-04 Enrica Casucci <e•••••@apple.com> Font::glyphDataAndPageForCharacter doesn't account for text orientation when using systemFallback on a cold cache. https://bugs.webkit.org/show_bug.cgi?id=98452. Reviewed by NOBODY (OOPS!). The text orientation was considered only when there is a cache hit. This change moves the logic to handle text orientation to a separate inline function that is called also when the glyph is added to the cache. Test: fast/text/vertical-rl-rtl-linebreak.html * platform/graphics/FontFastPath.cpp: (WebCore::applyTextOrientationForCharacter): Added. (WebCore::Font::glyphDataAndPageForCharacter): Modified to use the new function in both cases of cold and warm cache.
The “No new tests. (OOPS!)” line appears if
webkit-patch did not detect the addition of test cases. If your patch does not require test cases (or test cases are not possible), remove this line and explain why you didn’t write tests. Otherwise all changes require test cases which should be mentioned in the ChangeLog. If you keep this line in your ChangeLog entry, your patch will be rejected by the commit bot.
A WebKit reviewer must approve your patch before WebKit can accept it into the source control repository. A reviewer will typically either approve your patch (by responding with an
r=me in the bug report and marking the patch
review:+) or request revisions to your patch (and mark the patch
review:-). In rare cases a patch may be permanently rejected, meaning that the reviewer believes the feature should never be committed to the tree. The review process can consist of multiple iterations between you and the reviewer as you submit revised patches.
In either case, your responsibility for the patch does not end with the patch landing in the tree. There may be regressions from your change or additional feedback from reviewers after the patch has landed. You can watch the tree at build.webkit.org to make sure your patch builds and passes tests on all platforms. It is your responsibility to be available should regressions arise and to respond to additional feedback that happens after a check-in. Changes should succeed on all platforms, but it can be difficult to test on every platform WebKit supports. Be certain that your change does not introduce new test failures on the high-traffic Mac or Windows ports by comparing the list of failing tests before and after your change. Your change must at least compile on all platforms.
WebKit provides an automated system (commit-queue) for landing patches for any who would like to use it. To use the commit-queue, set the
commit-queue:? flag on your patch. A committer will set
commit-queue:+ and an automated process will download, build, run the layout tests, and submit your patch on your behalf. If the WebKit buildbots are passing, your patch should be landed within 15 minutes after
commit-queue:+ is set. See the commit-queue documentation for more information.
Our Committer and Reviewer policy provides details on obtaining commit and review privileges.