(→‎Good documentation comments: add nsTArray doc about memory safety when iterating)
(→‎Accumulated personal notes: Embed tls keys in pcap file)
 
(15 intermediate revisions by the same user not shown)
Line 53: Line 53:
* Example on how to request mass change in Bugzilla without generating Emails: https://bugzilla.mozilla.org/show_bug.cgi?id=1399258
* Example on how to request mass change in Bugzilla without generating Emails: https://bugzilla.mozilla.org/show_bug.cgi?id=1399258
* foxkeh dance [https://foxkehdance.com/ v1], [https://foxkehdance.com/2.0/ v2] [https://foxkeh.com/ original]
* foxkeh dance [https://foxkehdance.com/ v1], [https://foxkehdance.com/2.0/ v2] [https://foxkeh.com/ original]
* See tree status of all branches: https://treestatus.mozilla-releng.net/static/ui/treestatus/
* See tree status of all branches: https://lando.services.mozilla.com/treestatus/
* bugzilla reminder feature of BugBot: https://groups.google.com/a/mozilla.org/g/dev-platform/c/QznyG9gzwYc/m/aGS52shgAAAJ
* bugzilla reminder feature of BugBot: https://groups.google.com/a/mozilla.org/g/dev-platform/c/QznyG9gzwYc/m/aGS52shgAAAJ
** https://github.com/mozilla/bugbot/blob/7382d562b62dcee4492d242a2113310413d64550/bugbot/rules/reminder.py#L14
** https://github.com/mozilla/bugbot/blob/7382d562b62dcee4492d242a2113310413d64550/bugbot/rules/reminder.py#L14
Line 83: Line 83:
! Name !! URL !! Keyword
! Name !! URL !! Keyword
|-
|-
| Searchfox || <nowiki>https://searchfox.org/mozilla-central/search?path=&q=%s</nowiki> || s
| Searchfox || <nowiki>https://searchfox.org/firefox-main/search?path=&q=%s</nowiki> || s
|-
|-
| Bugzilla || <nowiki>https://bugzilla.mozilla.org/buglist.cgi?quicksearch=%s</nowiki> || b
| Bugzilla || <nowiki>https://bugzilla.mozilla.org/buglist.cgi?quicksearch=%s</nowiki> || b
Line 90: Line 90:
|-
|-
| Phabricator patch || <nowiki>https://phabricator.services.mozilla.com/%s</nowiki> || p
| Phabricator patch || <nowiki>https://phabricator.services.mozilla.com/%s</nowiki> || p
|-
| Fx Train || <nowiki>https://whattrainisitnow.com/release/?version=%s</nowiki> || fx
|-
|-
| RFCs datatracker || <nowiki>https://datatracker.ietf.org/doc/html/rfc%s</nowiki> || rfc
| RFCs datatracker || <nowiki>https://datatracker.ietf.org/doc/html/rfc%s</nowiki> || rfc
Line 100: Line 102:
* Public Roadmap 2024: https://connect.mozilla.org/t5/discussions/here-s-what-we-re-working-on-in-firefox/td-p/57694
* 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
* Pre Mercurial history commit history: https://github.com/ehsan/mozilla-cvs-history
* Oldest bug fixed on bugzilla: https://my-oldest-fixed-bugs.glitch.me/
* <code>./mach try fuzzy --env "MOZ_LOG=nsHttp:5,EarlyHint:5" --rebuild 20 netwerk/test/browser/browser_103_*</code>:
* <code>./mach try fuzzy --env "MOZ_LOG=nsHttp:5,EarlyHint:5" --rebuild 20 netwerk/test/browser/browser_103_*</code>:
** env for recording MOZ_LOGS and
** env for recording MOZ_LOGS and
Line 129: Line 130:
* It is possible to craft links to <code>about:logging</code> with a preset of logging modules: https://bugzilla.mozilla.org/show_bug.cgi?id=1949016#c7
* It is possible to craft links to <code>about:logging</code> with a preset of logging modules: https://bugzilla.mozilla.org/show_bug.cgi?id=1949016#c7
* [https://github.com/mystor/phlay phlay] is the better <code>moz-phab</code> that also allows setting custom submit message in patch revision history in phabricator [https://bugzilla.mozilla.org/show_bug.cgi?id=1962656]
* [https://github.com/mystor/phlay phlay] is the better <code>moz-phab</code> that also allows setting custom submit message in patch revision history in phabricator [https://bugzilla.mozilla.org/show_bug.cgi?id=1962656]
* [https://blog.techno-barje.fr/post/2019/09/17/trabant-calculator/ Trabant calculator] - fun little tool visualizing the Treeherder CI cost
* It is possible to create profiles, even when Firefox is unresponsive / stuck: https://profiler.firefox.com/docs/#/./async-posix-signal-control
* To run fenix instead of geckoview do <code>./mach run --app=fenix</code>
* js for platform code (toolkit) is stored in the <code>omni.ja</code> zip archive alongside the binary, browser frontent is in <code>browser/omni.js</code> (android it is in <code>assets/omni.ja</code>, roughly equivalent to the one in the root) and can be replaced if you want to test simple js changes without rebuild. Can be modified with <code>7z a ../omni.ja .</code>. You need to run firefox with <code>./firefox --purgecaches</code> for it to reload the .ja file.
* <code>call DumpJSStack()</code> in gdb
* Embed tls keys in pcap file: https://wiki.wireshark.org/TLS#embedding-decryption-secrets-in-a-pcapng-file
==Bookmarks==
* [https://vanilla.pascalc.net/dictionaries/ Inventory of dictionaries shipping in Firefox Desktop]
* [https://nchevobbe.github.io/my-oldest-fixed-mozilla-bugs/ My Oldest Fixed Bugs on Bugzilla]
* [https://transvision.mozfr.org/ Search translated Firefox strings]
* [https://mozilla.pettay.fi/uuidgen.html Uuid generator]
* [https://tranco-list.eu/ Tranco-List], [https://radar.cloudflare.com/domains Cloudflare domain ranking]
==Fun code==
==Fun code==


Line 219: Line 235:
  // cause elements to be missed or firefox to crash, but will not trigger memory
  // cause elements to be missed or firefox to crash, but will not trigger memory
  // safety problems due to the release-mode bounds checking found in ElementAt.
  // safety problems due to the release-mode bounds checking found in ElementAt.
* [https://searchfox.org/mozilla-central/rev/18bfd136df7f2fe618d8105549cccebb75ce92f5/netwerk/base/nsIURI.idl#17-29 nsIURI url part names]
  ftp://username:password@hostname:portnumber/pathname?query#ref
  \ /  \              / \      / \        /\      / \  / \ /
  -    ---------------  ------  --------  -------  ---  -
  |            |            |        |        |      |    |
  |            |            |        |      FilePath Query Ref
  |            |            |      Port      \            /
  |            |            Host      /          ------------
  |        UserPass                /                |
Scheme                              /                Path
  \                                /
    --------------------------------
                  |
                PrePath
* [https://firefox-source-docs.mozilla.org/setup/configuring_build_options.html#changing-build-options-per-directory-the-moz-build-hook Disabling optimize for a select subset of directories]


== Firefox Setting ==
== Firefox Setting ==

Latest revision as of 10:54, 27 November 2025

I am a mozillian in the Privacy-Team. I'm a former Necko-Team member. I like improving docs when reading through them.

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:

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
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"
 * sudo vim /etc/sysctl.d/10-rr.conf: kernel.perf_event_paranoid = 1
  • pernosco-submit upload --title "Bug # - ..." ~/.local/share/rr/latest-trace . ~/.mozbuild/ /usr/include /usr/lib ~/.rustup/
  • my bookmarks for address bar shortcuts:
Name URL Keyword
Searchfox https://searchfox.org/firefox-main/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
Fx Train https://whattrainisitnow.com/release/?version=%s fx
RFCs datatracker https://datatracker.ietf.org/doc/html/rfc%s rfc
Tor Bug https://gitlab.torproject.org/tpo/applications/tor-browser/-/issues/%s tor

Bookmarks

Fun code

  • Interesting workaround to have a public constructor, but not really [4]
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[5]
/**
 *  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);
  • backwards possible binary detection fun to read comment[6]
// 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[7]
// 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;
}
  • Sound the computer makes when executing the function[8]
def brrrrr(hosts, args)
  • Humble code comment when specifying non-existing test path[9]
It's possible my little brain doesn't know about the type of test you are
trying to execute. If you suspect this, please request support by filing
a bug at [Testing :: General].
  • "Somebody give me a better name"[10]. For mLSHE

Good documentation comments

https://searchfox.org/mozilla-central/rev/3840d8109501fbebdf22212165ea15a391280dcb/netwerk/ipc/DocumentChannel.h#32-39

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.

https://searchfox.org/mozilla-central/rev/3840d8109501fbebdf22212165ea15a391280dcb/netwerk/ipc/DocumentChannel.h#62-65

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.
// Mutating an array which is being iterated is still wrong, and will either
// cause elements to be missed or firefox to crash, but will not trigger memory
// safety problems due to the release-mode bounds checking found in ElementAt.
 ftp://username:password@hostname:portnumber/pathname?query#ref
 \ /   \               / \      / \        /\       / \   / \ /
  -     ---------------   ------   --------  -------   ---   -
  |            |             |        |         |       |    |
  |            |             |        |      FilePath Query Ref
  |            |             |       Port       \            /
  |            |            Host      /          ------------
  |         UserPass                 /                |
Scheme                              /                Path
  \                                /
   --------------------------------
                  |
               PrePath

Firefox Setting

AddOns:

Preferences:

Config:

  • toolkit.legacyUserProfileCustomizations.stylesheets true: to load userChrome/userContent
  • browser.compactmode.show true: to enable compact mode
  • extensions.pocket.enabled false: disable pocket

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