Skip to content

Instantly share code, notes, and snippets.

@asutherland
asutherland / pb-validation-steps-cache-api.md
Last active November 8, 2023 04:43
Private Browsing Validation Steps

asuth's Cache API Private Browsing Validation Steps

Note that all steps are being perform on Ubuntu linux with the following packages installed:

  • binutils-x86-64-linux-gnu for the strings command line tool.
    • Note that llvm also provides a strings tool, for example the llvm-14 package provides llvm-strings-14 which is equivalent for our purposes.
  • coreutils for the od command line tool.
  • ent for the ent command line tool whose homepage is https://www.fourmilab.ch/random/ (but whose debian package has diverged).
@asutherland
asutherland / SHUTDOWN.md
Created March 6, 2023 15:35
Out of date notes on shutdown

Browser Shutdown, how does it work?

General Overview

  • The parent process goes through a number of observer notifications that trigger different phases of shutdown. Traditionally, each observer would spin its own nested event loop until it was satisfied shutdown had been completed, resulting in serialized shutdown with a lot of potential inefficiency. We're now moving to using the AsyncShutdown mechanism which tells all its consumers about a phase in parallel and then spins a single event loop until they all report shutdown completion. If they don't do so in a timely fashion, a crash
@asutherland
asutherland / tc-coverage-timestamps.sh
Last active March 18, 2021 04:51
taskcluster coverage artifact upload date figurer-outer
#!/bin/bash
# This is a script to determine when mozilla-central code coverage artifacts
# were uploaded.
#
# It uses the "taskcluster" client-shell binary tool from
# https://github.com/taskcluster/taskcluster/tree/main/clients/client-shell
# and the "coreapi" command line tool referenced by
# https://treeherder.mozilla.org/docs/ and installable via
# `pip3 install coreapi` to do REST API stuff from inside bash.
@asutherland
asutherland / tc-list-coverage.sh
Last active January 13, 2021 17:13
taskcluster list coverage aggregation mozilla-central hook results
#!/bin/bash
# This is a script to help analyze the relative time that searchfox runs
# happened relative to the coverage aggregation runs.
#
# It uses the "taskcluster" client-shell binary tool from
# https://github.com/taskcluster/taskcluster/tree/main/clients/client-shell
# and the "coreapi" command line tool referenced by
# https://treeherder.mozilla.org/docs/ and installable via
# `pip3 install coreapi` to do REST API stuff from inside bash.
// RAII BASED
bool
WorkerPrivate::AddHolder(WorkerHolder* aHolder, WorkerStatus aFailStatus)
{
auto data = mWorkerThreadAccessible.Access();
{
MutexAutoLock lock(mMutex);
if (mStatus >= aFailStatus) {
@asutherland
asutherland / xbuttons.ahk
Created November 28, 2017 02:13
Windows mouse buttons 4 & 5 autohotkey script
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; Raise the window under the mouse without clicking on it.
XButton2::
MouseGetPos, , , id
WinActivate, ahk_id %id%
Return
@asutherland
asutherland / mc-list.sh
Created November 3, 2017 16:28
mc-list
#!/bin/bash
echo "mozilla-central checkout branch statuses"
echo "========================================"
. ~/rev_control/hg/hg-experimental/scripts/scm-prompt.sh
cd ~/rev_control/hg/mozilla-central
echo "mozilla-central :$(_scm_prompt)"
cd ~/rev_control/hg/mozilla-unified
echo "mozilla-unified :$(_scm_prompt)"
cd ~/rev_control/hg/mozilla-beta
@asutherland
asutherland / shared-data-worker.html
Created September 15, 2016 21:39
SharedWorkers using data URL's
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<script type="application/javascript">
// Create a data worker that tracks its start time and does a console.log when it receives a message.
var w = new SharedWorker("data:application/javascript,d = Date.now(); onconnect = evt => { evt.ports[0].onmessage = _ => console.log(d); evt.ports[0].start() }")
// Now send it that message. If you open this page in two tabs, the second console.log should log the same time as the first.
@asutherland
asutherland / child-frame.html
Created November 16, 2015 20:40
iframe entrainment investigation
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="child-frame.js" type="application/javascript"></script>
</head>
<body id="content">
<div id="expando-friend">
Child!
</div>
@asutherland
asutherland / a-way-to-bookmark-windows.md
Last active August 29, 2015 14:17
xdotool window hotkey bookmarking

Two shell scripts to bookmark and restore bookmarks for windows. Based on exact window id's.

You then use these in your desktop environment's global keybindings. For example I have bound:

  • Alt-Super-1 to "bookmark-window-as 1"
  • Super-1 to "bookmark-activate-window 1" And so on for all digits. You could also use letters or whatever you want.

Note that if you don't want bookmarking and instead just want Super-F to always bring up your Firefox window, you want to do things like directly invoke "xdotool search --class firefox windowactivate" (which is literally an example I just ripped from "man xdotool").