Last active
December 22, 2023 21:58
-
-
Save buttercookie42/7b094da45c698a6228046cb69278df60 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To enable the crash reporter on local builds: | |
export MOZ_CRASHREPORTER=1 and re-run mach config to pick up the change | |
adb logcat -s "GeckoMemoryMonitor" | |
adb shell am broadcast -a org.mozilla.gecko.FORCE_MEMORY_PRESSURE | |
adb shell am force-stop org.mozilla.fennec_jan | |
adb shell am kill org.mozilla.fennec_jan | |
adb shell am start -n org.mozilla.fennec_aurora/.App -a android.intent.action.VIEW --es args '-profile /sdcard/tests/tmpwuju6s.mozrunner' | |
function dump(a) { | |
Services.console.logStringMessage(a); | |
} | |
Busy sleep in JS: | |
log("sleeping 20 s"); | |
this._sleep(20000); | |
log("returned from sleep"); | |
_sleep: function sleepFor(sleepDuration) { | |
var now = new Date().getTime(); | |
while(new Date().getTime() < now + sleepDuration){ /* do nothing */ } | |
} | |
/* import-globals-from head.js */ | |
Fuzzy hg import | |
hg import --config ui.patch="patch --merge" fuzzy.patch | |
./mach build && ./mach package && ./mach gradle clean app:assembleWithGeckoBinariesDebug | |
./mach build && ./mach package && ./mach gradle app:assembleWithGeckoBinariesDebug | |
./mach gradle app:assembleWithGeckoBinariesDebug | |
./mach gradle app:installWithGeckoBinariesDebug | |
Rebuild Robocop: | |
./mach gradle app:assembleWithGeckoBinariesDebugAndroidTest | |
./mach gradle app:installWithGeckoBinariesDebugAndroidTest | |
Geckoview Test: | |
./mach gradle geckoview:installWithGeckoBinariesDebugAndroidTest | |
./mach geckoview-junit org.mozilla.geckoview.test.ContentDelegateTest#saveAndRestoreState | |
API Lint: | |
./mach gradle apiLintWithGeckoBinariesDebug | |
./mach gradle apiUpdateFileWithGeckoBinariesDebug | |
./mach gradle apiChangelogCheckWithGeckoBinariesDebug | |
General lint (now including Android): | |
./mach lint --outgoing | |
Fix package errors in dist/bin: | |
rm -rf dist/bin && ./mach build && ./mach package | |
Strg + Alt + Shift + I: bring up inspections in Android Studio (e.g. unused resources) | |
Profiling startup: | |
adb shell am start -n org.mozilla.fennec_aurora/.App --es env0 MOZ_PROFILER_STARTUP=1 --es env1 MOZ_PROFILER_SHUTDOWN=/storage/emulated/0/profile.json | |
If it looks like the buffer is not large enough, you can tweak the buffer size with the env var MOZ_PROFILER_STARTUP_ENTRIES. | |
This defaults to 1000000, which is 9MB. If you want 90MB use 10000000, and 20000000 for 180MB, which are good values to debug long startups. | |
or https://github.com/snorp/fennec-profiler-addon | |
DumpJSStack() | |
extern JS_FRIEND_API bool DumpPC(JSContext* cx); | |
extern JS_FRIEND_API bool DumpScript(JSContext* cx, JSScript* scriptArg); | |
export DEBUG_FRAME_DUMP=1 | |
MOZ_LOG=frame:5 | |
$someFrame->PresContext()->GetPresShell()->GetRootFrame()->List(stderr, 0, 0) | |
Layout Debugger: ./mach run -layoutdebug | |
#define BLABLA_LOG(...) printf_stderr("BLABLA: " __VA_ARGS__) | |
devtools.debugger.new-debugger-frontend | |
user_pref("browser.tabs.remote.force-disable", false); | |
export MOZ_FORCE_DISABLE_E10S=92.0a1 (= current version) | |
unset MOZ_FORCE_DISABLE_E10S | |
launch custom tab: | |
--esn android.support.customtabs.extra.SESSION -a android.intent.action.VIEW -d http://www.buttercookie.de | |
Logging: | |
export MOZ_LOG=MediaDemuxer:5,MediaResourceIndex:5,MediaCache:5 | |
export MOZ_LOG_FILE="D:\Users\Jan\Documents\Mozilla\skip\MP3.log" | |
alternatively redirect output from stderr to file, e.g. | |
mach run > run.log 2>&1 | |
GDB: | |
Ctrl + C = break | |
continue / c | |
step / s = single step | |
next / = step over | |
break <file:line or functionname> = set breakpoint | |
bt = backtrace calling stack | |
print <variable name> | |
LLDB: | |
pro hand -p true -s false SIGBUS = ignore signal | |
Python: | |
import pdb; pdb.set_trace() | |
HG alias for empty commit | |
[alias] empty = !touch tmp ; $HG add tmp ; $HG commit tmp -m "<enter commit message>" ; $HG rm tmp ; $HG commit tmp --amend "$@" | |
on Windows: | |
empty = !touch tmp && hg add tmp && hg commit tmp -m "<enter commit message>" && hg rm tmp && hg commit tmp --amend "$@" | |
Change commit author | |
hg ci --amend --user "My Name <[email protected]>" -X "**" | |
hg ci --amend --user "André Bargull <[email protected]>" -X "**" | |
Import from Phabricator: | |
hg phabread <last revision in stack> --stack | hg import - | |
Redirect output for faster builds | |
./mach build > build.log 2>&1 | |
Set alternative mozconfig | |
export MOZCONFIG=/absolute/path/to/mozconfig | |
Update rust: | |
rustup update | |
cargo install --force sccache | |
cargo install --force cbindgen | |
Update Mozilla clang: | |
./mach artifact toolchain --from-build linux64-clang && rm -rf ~/.mozbuild/clang && mv clang ~/.mozbuild/clang | |
./mach artifact toolchain --from-build linux64-clang-tidy && rm -rf ~/.mozbuild/clang-tools/clang-tidy && mv clang ~/.mozbuild/clang-tools/clang-tidy | |
./mach artifact toolchain --from-build win64-clang && rm -rf ~/.mozbuild/clang && mv clang ~/.mozbuild/clang | |
Screenshot via adb: | |
adb shell screencap -p | sed 's/\r$//' > screen.png | |
adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > screen.png | |
adb exec-out screencap -p > screen.png | |
android.os.Debug.waitForDebugger(); | |
adb shell dumpsys meminfo <your proc name> | |
Enable Desktop remote debugging: | |
Shift + F2 for developer console, then "listen <port>" | |
./mach mochitest-browser --jsdebugger <my-test(s)> | |
layout.word_select.stop_at_underscore | |
GeckoConsole|GeckoSession|GeckoBrowser: | |
root shell: | |
sudo -s | |
disk space: | |
df -h | |
sudo -i; baobab | |
Reclaim empty virtual disk space: | |
e4defrag /dev/sda1 | |
dd if=/dev/zero of=wipefile bs=1024x1024; rm wipefile | |
Compact disk in VMWare | |
After expanding the VMWare disk, resizing the partition works via gparted | |
first swapoff, then move swap partition, then expand main partition in a separate step, otherwise gparted will force 1 MB of unallocated space between the two partitions | |
Desktop UI missing: | |
"kill -9 -1" to get back to login screen | |
either clear ~/.cache/compizconfig-1, or copy it from a fresh user | |
curl -s --compressed -G -d "format=text" --url "https://android.googlesource.com/platform/prebuilts/maven_repo/android/+/master/com/android/support/support-v4/24.0.0/support-v4-24.0.0-sources.jar" | base64 -d > support-v4-24.0.0-sources.jar | |
Block PWA button with uBlock: | |
*$csp=manifest-src 'none' | |
Google Safebrowsing/Mozilla Geolocation API keys are hidden in resource://gre/components/nsURLFormatter.js | |
(later Firefox versions might have the keys in AppConstants.jsm?) | |
FX Accounts: | |
https://accounts.firefox.com/?context=fx_desktop_v3&entrypoint=preferences&action=email&service=sync | |
https://accounts.firefox.com/signin?context=fx_desktop_v3&entrypoint=preferences&action=email&service=sync | |
https://accounts.firefox.com/?context=fx_fennec_v1&entrypoint=fxa%3Aenter_email&service=sync&action=email | |
https://hg.mozilla.org/mozilla-central/log?rev=sort%28%28file%28%27mobile%2F%2A%2A%27%29%20or%20file%28%27widget%2Fandroid%2F%2A%2A%27%29%20or%20file%28%27build.gradle%27%29%20or%20keyword%28Android%29%20or%20keyword%28mobile%29%29%20and%20not%20merge%28%29%2C%20rev%29&revcount=100 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment