User:Manuel Bucher
From MozillaWiki
I am a mozillian in the Privacy-Team. I'm a former Necko-Team member. I like improving docs when reading through them.
Contents
Quick links for Firefox: Security triage
Accumulated personal notes
My personal TODO-List for my outstanding documentation changes (where I don't have the time to do them immediately)/My non-trivially learned lessons about Firefox development:
- https://github.com/mystor/git-revise: Speed up builds (15s instead of 20min) after rebase (use
git revise
instead) when usinggit cinnebar
- my
.mozconfig
:
ac_add_options --enable-debug ac_add_options --enable-clang-plugin #ac_add_options --disable-unified-build ac_add_options --with-ccache=sccache ac_add_options CCACHE=/home/user/.mozbuild/sccache/sccache
- Setup distributed sccache following https://firefox-source-docs.mozilla.org/build/buildsystem/sccache-dist.html
- Bugzilla instant search. It's the same as duplicate search when entering bugs. Easier to find bugs with this search than the normal for me: https://bugzilla.mozilla.org/query.cgi?format=instant
- moz-phab can be used to download and checkout patches from phabricator using
moz-phab patch D000000
and replace D000000 with the patch-id from phabricator - Documentation of the test
.ini
files: https://firefox-source-docs.mozilla.org/build/buildsystem/test_manifests.html - Moz-config helper:
- Old error page dinosaur picture:
- Searchfox shows the Bugzilla component for files in the navigation box on the right side: https://searchfox.org/mozilla-central/rev/4582d908c17fbf7924f5699609fe4a12c28ddc4a/netwerk/cache2/CacheFile.h
- mozregression
- https://moz-conduit.readthedocs.io/: Introduction to the set of systems involved in submitting code to mozilla-central.
- https://arewefastyet.com/
- Firefox language stats: https://4e6.github.io/firefox-lang-stats/
- (slightly outdated) nsresult integer -> error symbolic name lookup: https://james-ross.co.uk/mozilla/misc/nserror
- Also possible via searchfox: https://searchfox.org/mozilla-central/source/__GENERATED__/xpcom/base/error_list.rs
- Treeherder user guide
- Creating a simple http server as a bash one-liner:
while [ 1 ]; do printf 'HTTP/1.0 200 OK\r\nContent-Type: text/html; charset=UTF-8\r\nConnection: close\r\nContent-Length: 27\r\n\r\n<!DOCTYPE html>Hello World!' | nc -l 5555; done
- how to use tc: https://github.com/tylertreat/comcast/tree/461b29c71e8edc00b2a12309cd67617c5643ed61#linux
- Test server domain names: https://searchfox.org/mozilla-central/source/build/pgo/server-locations.txt
- Query for bugs with much interest: https://sylvestre.ledru.info/moz/bugscore.html
- URL validator: https://jsdom.github.io/whatwg-url/
- To get from mercurial hash to searchfox link: There's an /hgrev/ endpoint that will redirect the hg revision to the git revision. For example https://searchfox.org/mozilla-central/hgrev/e84648aa607a32b9e4bbd2378f5a7caf9e31264a/dom/cache/DBAction.cpp#215
- Example on how to request mass change in Bugzilla without generating Emails: https://bugzilla.mozilla.org/show_bug.cgi?id=1399258
- foxkeh dance v1, v2 original
- See tree status of all branches: https://treestatus.mozilla-releng.net/static/ui/treestatus/
- bugzilla reminder feature of BugBot: https://groups.google.com/a/mozilla.org/g/dev-platform/c/QznyG9gzwYc/m/aGS52shgAAAJ
- Searching for Open and closed bugs in Bugzilla: Start the search query with "ALL"
- Firefox Nightly Asan builds: https://firefox-source-docs.mozilla.org/tools/sanitizer/asan_nightly.html
- Firefox .desktop file: https://blog.nightly.mozilla.org/2016/09/19/getting-firefox-nightly-to-stick-to-ubuntus-unity-dock/
- Firefox release calendar: https://whattrainisitnow.com/calendar/
- my fish aliases:
alias --save mb="mach build" alias --save mbf="mach build faster" alias --save mc="mach clobber" alias --save mcb="mach clobber && mach build" alias --save mr="mach run" alias --save mrr='mach run --debugger=rr --debugger-args="record --disable-avx-512 --disable-cpuid-features-ext 0xfc230000,0x2c42,0xc"' alias --save mt="mach test" alias --save mtr='mach test --debugger=rr --debugger-args="record --disable-avx-512 --disable-cpuid-features-ext 0xfc230000,0x2c42,0xc"' alias --save mp="moz-phab"
- my bookmarks for address bar shortcuts:
Name | URL | Keyword |
---|---|---|
Searchfox | https://searchfox.org/mozilla-central/search?path=&q=%s | s |
Bugzilla | https://bugzilla.mozilla.org/buglist.cgi?quicksearch=%s | b |
Bugzilla bug | https://bugzilla.mozilla.org/show_bug.cgi?id=%s | bug |
Phabricator patch | https://phabricator.services.mozilla.com/%s | p |
RFCs datatracker | https://datatracker.ietf.org/doc/html/rfc%s | rfc |
Tor Bug | https://gitlab.torproject.org/tpo/applications/tor-browser/-/issues/%s | tor |
-
./mach test path/to/test.js --jsdebugger
and addingdebugger;
-statement allows to stepping through js test code in devtools - sccache-dist: setup doc, ffsd, wiki doc
- Public Roadmap 2024: https://connect.mozilla.org/t5/discussions/here-s-what-we-re-working-on-in-firefox/td-p/57694
- Pre Mercurial history commit history: https://github.com/ehsan/mozilla-cvs-history
- Oldest bug fixed on bugzilla: https://my-oldest-fixed-bugs.glitch.me/
-
./mach try fuzzy --env "MOZ_LOG=nsHttp:5,EarlyHint:5" --rebuild 20 netwerk/test/browser/browser_103_*
:- env for recording MOZ_LOGS and
- rebuild for running test cases multiple times (here 20)
- Try high scores: https://catlee.github.io/highscores/highscores.html
- Convert git hash to hg hash with git cinnabar:
git cinnabar git2hg 028d2077b6267f634c161a8a68e2feeee0cfb663
- Create permalink to bug list from Firefox devtools console:
"https://bugzilla.mozilla.org/buglist.cgi?bug_id=" + Array.from(document.querySelectorAll(".bz_bug_link")).map(a => a.innerHTML).join(",")
- Old 3D view: https://firefox-source-docs.mozilla.org/devtools-user/3d_view/index.html
- Website showing fingerprint:
Fun code
- Interesting workaround to have a public constructor, but not really [1]
class WorkerThread { // Using this struct we restrict access to the constructor while still being // able to use MakeSafeRefPtr. struct ConstructorKey {}; public: explicit WorkerThread(ConstructorKey); }
- A long function name indicating that this function must not be called in non-test code[2]
/** * NOTE: This function is used only for testing! * * @param aDisable If true, disable all security check and make * hasMatchingOverride always return true. */ void setDisableAllSecurityChecksAndLetAttackersInterceptMyData(in boolean aDisable);
- parameter called
justKidding
on a function calledReal...
: https://searchfox.org/mozilla-central/search?q=justKidding&redirect=false
- backwards possible binary detection fun to read comment[3]
// Make sure to do a case-sensitive exact match comparison here. Apache // 1.x just sends text/plain for "unknown", while Apache 2.x sends // text/plain with a ISO-8859-1 charset. Debian's Apache version, just to // be different, sends text/plain with iso-8859-1 charset. For extra fun, // FC7, RHEL4, and Ubuntu Feisty send charset=UTF-8. Don't do general // case-insensitive comparison, since we really want to apply this crap as // rarely as we can.
- Reason for socks proxy not being supported via system proxy settings on linux[4]
// Is there a way to specify "socks://" or something in these environment // variables? I can't find any documentation. if (!proxyURI->SchemeIs("http")) { return NS_ERROR_UNKNOWN_PROTOCOL; }
def brrrrr(hosts, args)
Good documentation comments
DocumentChannel is a protocol agnostic placeholder nsIChannel implementation that we use so that nsDocShell knows about a connecting load. It transfers all data into a DocumentLoadListener (running in the parent process), which will create the real channel for the connection, and decide which process to load the resulting document in. If the document is to be loaded in the current process, then we'll synthesize a redirect replacing this placeholder channel with the real one, otherwise the originating docshell will be removed during the process switch.
Will create the appropriate document channel: Either a DocumentChannelChild if called from the content process or a ParentProcessDocumentChannel if called from the parent process. This operation is infallible.
- Variant documentation: https://searchfox.org/mozilla-central/rev/ffa4d00965c5281def6d3ddcbcdf6259d38c9b9a/mfbt/Variant.h#364-568
- MozPromise documentation: https://searchfox.org/mozilla-central/rev/a64647a2125cf3d334451051491fef6772e8eb57/xpcom/threads/MozPromise.h#104-146
- ScopeExit documentation: https://searchfox.org/mozilla-central/rev/aa3ccd258b64abfd4c5ce56c1f512bc7f65b844c/mfbt/ScopeExit.h#13-80
- nsIMemoryReporter
- It is possible to search for open tabs by starting the search with a "%" character
- PromiseFlatString/PromiseFlatCString
Firefox Setting
AddOns:
Preferences:
- HTTPS-Only mode in all windows
- Firefox Sync -> Most things don't have to be setup again. Not being synced is Bug 978010 Cookies and Site Data exceptions and Bug 1676519 Extensions "Run in Private Browsing". Both depend on permissions being able to be synced.
Config:
-
toolkit.legacyUserProfileCustomizations.stylesheets true
: to load userChrome/userContent -
browser.compactmode.show true
: to enable compact mode
Further customization:
- chrome/userChrome.css
/* Hide horizontal tabs at the top of the window */ #tabbrowser-tabs { visibility: collapse !important; } /* Hide the "Tree Style Tab" header at the top of the sidebar */ #sidebar-header { display: none; }
- chrome/userContent.css
/* https://gist.github.com/boppreh/64f98fa499c946d3e38b2b852f9517fb */ /* Give a grey title to visited Youtube links */ @-moz-document domain(www.youtube.com) { a:visited { color: grey !important; } a:visited > h3.ytd-compact-video-renderer { color: grey !important; } a:visited > yt-formatted-string { color: grey !important; } }
- Advanced css settings in TreeStyleTab:
/* Show title of unread tabs with red and italic font */ :root.sidebar tab-item.unread .label-content { color: red !important; font-style: italic !important; } /* Change tab height */ tab-item { --tab-size: 22px !important; height: var(--tab-size); } /* Add private browsing indicator per tab */ :root.sidebar tab-item.private-browsing tab-label:before { content: "🕶"; }
Networking component size
(roughly on 118.0a1 2023-08-03 https://hg.mozilla.org/mozilla-central/rev/1eb2f6905e74)
netwerk/$ fd {} | xargs cat | wc -l
- Http2: 11276
- Http3: 5219
- HttpChannel: 24753
- Channel: 61179
- Transaction: 7973
- Connection: 13077
- ConnectionMgr: 5190
- WebSocket: 9375