Skip to content

Instantly share code, notes, and snippets.

mostly working in mozilla repositories these days

Jared Hirsch jaredhirsch

mostly working in mozilla repositories these days
View GitHub Profile
jaredhirsch /
Last active Jan 25, 2022
My notes from the C++ and Gecko onboarding video
jaredhirsch /
Last active Nov 6, 2019
attaching debuggers to things

(Note: I moved this info into the main FxA readme at

Attaching a debugger to a running node process, sadly, requires running google chrome (AFAIK).

How to do it:

  1. Start google chrome and open up chrome://inspect.

  2. Run a node process using the --inspect or --inspect-brk flags (see specific command-line incantations below)

jaredhirsch / ugh
Created Jul 9, 2019
fxa monorepo npm install = node-gyp dumpster fires
View ugh
[15:51:37 mozilla-fxa (mozilla-master) ]$ npm install
> fxa@2.0.0 postinstall /Users/jh/codez/github/mozilla-fxa
> _scripts/
+ '[' '' = true ']'
+ _scripts/
+ _scripts/
++ which rustup
+ [[ ! -n /Users/jh/.cargo/bin/rustup ]]
View foo
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "src/libbacktrace" "-I" "/Users/jh/codez/github/mozilla-fxa/packages/fxa-email-service/target/debug/build/backtrace-sys-a925084960b3e8d2/out" "-fvisibility=hidden" "-DBACKTRACE_SUPPORTED=1" "-DBACKTRACE_USES_MALLOC=1" "-DBACKTRACE_SUPPORTS_THREADS=0" "-DBACKTRACE_SUPPORTS_DATA=0" "-DHAVE_DL_ITERATE_PHDR=1" "-D_GNU_SOURCE=1" "-D_LARGE_FILES=1" "-Dbacktrace_full=__rbt_backtrace_full" "-Dbacktrace_dwarf_add=__rbt_backtrace_dwarf_add" "-Dbacktrace_initialize=__rbt_backtrace_initialize" "-Dbacktrace_pcinfo=__rbt_backtrace_pcinfo" "-Dbacktrace_syminfo=__rbt_backtrace_syminfo" "-Dbacktrace_get_view=__rbt_backtrace_get_view" "-Dbacktrace_release_view=__rbt_backtrace_release_view" "-Dbacktrace_alloc=__rbt_backtrace_alloc" "-Dbacktrace_free=__rbt_backtrace_free" "-Dbacktrace_vector_finish=__rbt_backtrace_vector_finish" "-Dbacktrace_vector_grow=__rbt_backtrace_vector_grow" "-Dbacktrace_vector_release=__rbt_backtrace_vector_release" "-Dbacktr
jaredhirsch / :-(
Created Jul 9, 2019
fxa-auth-server: trying to install on node 10.16.0 / mac 10.14.5
View :-(
[15:15:11 fxa-auth-server (mozilla-master) ]$ npm install
> @newrelic/native-metrics@3.1.2 install /Users/jh/codez/github/mozilla-fxa/packages/fxa-auth-server/node_modules/@newrelic/native-metrics
> node ./lib/pre-build.js install native_metrics
> /usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean configure
> /usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build -j 6 native_metrics
CXX(target) Release/
CXX(target) Release/
CXX(target) Release/
jaredhirsch / foo
Created Jul 9, 2019
fxa-js-client errors after npm setup && npm test without separately installing intern-geezer
View foo
[09:00:49 fxa-js-client (mozilla-master) ]$ npm run test
> fxa-js-client@1.0.14 test /Users/jh/codez/github/mozilla-fxa/packages/fxa-js-client
> grunt test
Running "intern:node" (intern) task
DEBUG: 'failed to load resource (/Users/jh/codez/github/mozilla-fxa/packages/fxa-js-client/node_modules/intern-geezer/node_modules/dojo/_base/array.js)'
DEBUG: { Error: ENOENT: no such file or directory, open '/Users/jh/codez/github/mozilla-fxa/packages/fxa-js-client/node_modules/intern-geezer/node_modules/dojo/_base/array.js'
at Object.openSync (fs.js:443:3)
at Object.readFileSync (fs.js:343:35)
jaredhirsch / foo.diff
Created Jan 26, 2019
Converting hostname to login title: the PSL approach
View foo.diff
commit d67700eadc05178d275d526bd696f2dacaf83221
Author: Jared Hirsch <>
Date: Tue Jan 22 16:21:23 2019 -0800
Add Logins API utility method to get domain name, minus TLD, from a URL
diff --git a/src/experiments/logins/api.js b/src/experiments/logins/api.js
index 15dbf53..71412a2 100644
--- a/src/experiments/logins/api.js
+++ b/src/experiments/logins/api.js
jaredhirsch /
Created Oct 24, 2017
debugging is fun yay

this is webpack require 8 in studyutils.jsm, beautified:

module.exports = {
    "$schema": "",
    "title": "study setup",
    "type": "object",
    "definitions": {
        "idString": {
            "description": "between 1,100 chars, no spaces, unicode ok.",
jaredhirsch /
Created Aug 10, 2017
Screenshots - Bug 1387598 / Intermittent sessionrestore_no_auto_restore | application crashed [@ GetNameOperation]

I got pinged on bug 1387598, some Windows-only crashes in a Talos test that deliberately prevents the sessionstore-windows-restored event from firing. Screenshots 10.10 seemed to cause the regression. (As a reminder, 10.10 includes a fix to synchronize startup and shutdown, see discussion in screenshots pull request #3260.)

Looking at the Talos test definition on dxr, it appears that the test causes the event to never fire:

# inside mozilla-central/testing/talos/talos/, revision 4c5fbf493763, line 181:

class sessionrestore_no_auto_restore(sessionrestore):
jaredhirsch / gist:4761fee0a92c9559d0666e4edfbde851
Last active Apr 13, 2018
query monitoring: postgres on AWS
View gist:4761fee0a92c9559d0666e4edfbde851

I did a little preliminary research today on how to measure postgres performance, including on AWS.

How Postgres query performance measurement works

Postgres can be configured to log query-related data.

These logs can be exported to tools like pgbadger or hosted tools like pganalyze. Datadog seems to have some options, too.

Postgres query measurement on RDS