Skip to content

Commit 8565e72

Browse files
authored
chore: consolidate browser cheatsheets (#5832)
1 parent 5835c7e commit 8565e72

File tree

3 files changed

+77
-55
lines changed

3 files changed

+77
-55
lines changed

browser_patches/README.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
- [Contributing Browser Patches](#Contributing-browser-patches)
2+
* [1. Setting up local browser checkout](#1-setting-up-local-browser-checkout)
3+
* [2. Developing a new change](#2-developing-a-new-change)
4+
* [3. Exporting your change to playwright repo](#3-exporting-your-change-to-playwright-repo)
5+
* [4. Rolling Playwright to the new browser build](#4-rolling-playwright-to-the-new-browser-build)
6+
- [Cheatsheet](#cheatsheet)
7+
* [Firefox](#firefox)
8+
- [stack trace](#stack-trace)
9+
- [logging](#logging)
10+
* [WebKit](#webkit)
11+
- [Debugging Windows](#degugging-windows)
12+
- [Enable core dumps on Linux](#enable-core-dumps-on-linux)
13+
114
# Contributing Browser Patches
215

316
Firefox and WebKit have additional patches atop to expose necessary capabilities.
@@ -63,3 +76,67 @@ Once the patch has been committed, the build bots will kick in, compile and uplo
6376
```sh
6477
$ node utils/roll_browser.js chromium 123456
6578
```
79+
80+
# Cheatsheet
81+
82+
## FireFox
83+
84+
#### Stack trace
85+
86+
In `//mozglue/misc/StackWalk.cpp` add
87+
88+
```c++
89+
#define MOZ_DEMANGLE_SYMBOLS 1
90+
```
91+
92+
In native code use
93+
94+
```c++
95+
nsTraceRefcnt::WalkTheStack(stderr);
96+
```
97+
98+
If the stack trace is still mangled `cat` it to `tools/rb/fix_linux_stack.py`
99+
100+
#### Logging
101+
102+
Upstream documentation: https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Gecko_Logging
103+
104+
```bash
105+
MOZ_LOG=nsHttp:5
106+
```
107+
108+
Module name is a string passed to the `mozilla::LazyLogModule` of the corresponding component, e.g.:
109+
110+
```c++
111+
LazyLogModule gHttpLog("nsHttp");
112+
```
113+
114+
## WebKit
115+
116+
#### Debugging windows
117+
118+
In `Source\WTF\wtf\win\DbgHelperWin.cpp` replace
119+
120+
```#if !defined(NDEBUG)``` with ```#if 1```
121+
122+
Then regular `WTFReportBacktrace()` works.
123+
124+
#### Enable core dumps on Linux
125+
126+
```bash
127+
mkdir -p /tmp/coredumps
128+
sudo bash -c 'echo "/tmp/coredumps/core-pid_%p.dump" > /proc/sys/kernel/core_pattern'
129+
ulimit -c unlimited
130+
```
131+
132+
Then to read stack traces run the following command:
133+
```bash
134+
# To find out crashing process name
135+
file core-pid_29652.dump
136+
# Point gdb to the local binary of the crashed process and the core file
137+
gdb $HOME/.cache/ms-playwright/webkit-1292/minibrowser-gtk/WebKitWebProcess core-pid_29652
138+
# Inside gdb update .so library search path to the local one
139+
set solib-search-path /home/yurys/.cache/ms-playwright/webkit-1292/minibrowser-gtk
140+
# Finally print backtrace
141+
bt
142+
```

browser_patches/firefox/cheatsheet.md

Lines changed: 0 additions & 28 deletions
This file was deleted.

browser_patches/webkit/cheatsheet.md

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)